public Form1() { InitializeComponent(); InitBrowser(); InitTimer(); DbStore.Init(); }
private void Browser_FrameLoadEnd(object sender, FrameLoadEndEventArgs e) { try { if (!string.Equals(e.Url, startPage, StringComparison.OrdinalIgnoreCase)) { return; } if (e.Frame.IsMain) { string str2 = Guid.NewGuid().ToString().Substring(0, 2); string str3 = Guid.NewGuid().ToString().Substring(0, 2); string username = "******" + randomer.Next(99999 + 1, 999999999); string pwd = str3 + randomer.Next(99999 + 1, 999999999).ToString(); //由于页面判断没能使用Flash,需间隔一下,才展示元素,因此这里也需要延时2秒钟。 string str = @" setTimeout(function() { document.getElementById('main').click(); $('#login_account').val('@username'); $('#password').val('@pwd'); $('#password1').val('@pwd'); setTimeout(function() { $('#submitbtn').click(); }, 1000); }, 2000); ".Replace("@username", username) .Replace("@pwd", pwd); CountNum++; ShowMsg($"[{CountNum}] registering:{username},{pwd}"); DbStore.Store($"{username},{pwd}"); e.Frame.ExecuteJavaScriptAsync(str); } } catch (Exception ex) { ShowMsg(ex.Message); } }