コード例 #1
0
 public TournamentScraper(string firefoxPath, string firefoxProfilePath)
 {
     binary = new OpenQA.Selenium.Firefox.FirefoxBinary(firefoxPath);
     profile = new OpenQA.Selenium.Firefox.FirefoxProfile(firefoxProfilePath);
     driver = new OpenQA.Selenium.Firefox.FirefoxDriver(this.binary, this.profile);
 }
コード例 #2
0
 public TournamentScraper()
 {
     binary = new OpenQA.Selenium.Firefox.FirefoxBinary();
     profile = new OpenQA.Selenium.Firefox.FirefoxProfile();
     driver = new OpenQA.Selenium.Firefox.FirefoxDriver(this.binary, this.profile);
 }
コード例 #3
0
 public TournamentScraper()
 {
     binary  = new OpenQA.Selenium.Firefox.FirefoxBinary();
     profile = new OpenQA.Selenium.Firefox.FirefoxProfile();
     driver  = new OpenQA.Selenium.Firefox.FirefoxDriver(this.binary, this.profile);
 }
コード例 #4
0
 public TournamentScraper(string firefoxPath, string firefoxProfilePath)
 {
     binary  = new OpenQA.Selenium.Firefox.FirefoxBinary(firefoxPath);
     profile = new OpenQA.Selenium.Firefox.FirefoxProfile(firefoxProfilePath);
     driver  = new OpenQA.Selenium.Firefox.FirefoxDriver(this.binary, this.profile);
 }
コード例 #5
0
ファイル: Form1.cs プロジェクト: pointmoon/TestSelenium
        private void button1_Click(object sender, EventArgs e)
        {
            UserAgent                = UserAgentTextBox.Text;
            button1.Enabled          = false;
            UserAgentTextBox.Enabled = false;

            OpenQA.Selenium.Firefox.FirefoxProfile profile = new OpenQA.Selenium.Firefox.FirefoxProfile();
            OpenQA.Selenium.Firefox.FirefoxOptions option  = new OpenQA.Selenium.Firefox.FirefoxOptions();
            profile.SetPreference("general.useragent.override", UserAgent);
            option.Profile = profile;
            Browser        = new OpenQA.Selenium.Firefox.FirefoxDriver(option);

            Browser.Manage().Window.Maximize();
            Browser.Navigate().GoToUrl("https://www.instagram.com/");
            Browser.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);

            //----------------эл.адрес----------------
            IWebElement email       = Browser.FindElement(By.Name("emailOrPhone"));
            string      str_email_1 = RandomString(11, "LetterAndNumber");
            string      str_email_2 = "@" + "yandex.ru";
            string      str_email   = str_email_1 + str_email_2;

            SendToPage(email, str_email_1);
            SendToPage(email, str_email_2);
            //антиБОТ
            System.Threading.Thread.Sleep(1000);

            //----------------имя и фамилия----------------
            IWebElement name       = Browser.FindElement(By.Name("fullName"));
            string      str_name_1 = RandomString(7, "Letter");
            string      str_name_2 = " ";
            string      str_name_3 = RandomString(8, "Letter");
            string      str_name   = str_name_1 + str_name_2 + str_name_3;

            SendToPage(name, str_name_1);
            SendToPage(name, str_name_2);
            SendToPage(name, str_name_3);
            //антиБОТ
            System.Threading.Thread.Sleep(1000);

            //----------------имя пользователя----------------
            IWebElement username       = Browser.FindElement(By.Name("username"));
            string      str_username_1 = RandomString(5, "LetterAndNumber");
            string      str_username_2 = RandomString(5, "LetterAndNumber");
            string      str_username   = str_username_1 + str_username_2;

            SendToPage(username, str_username_1);
            SendToPage(username, str_username_2);
            //антиБОТ
            System.Threading.Thread.Sleep(1000);

            //----------------пароль----------------
            IWebElement password       = Browser.FindElement(By.Name("password"));
            string      str_password_1 = RandomString(2, "LetterAndNumber");
            string      str_password_2 = RandomString(4, "LetterAndNumber");
            string      str_password_3 = RandomString(4, "LetterAndNumber");
            string      str_password   = str_password_1 + str_password_2 + str_password_3;

            SendToPage(password, str_password_1);
            SendToPage(password, str_password_2);
            SendToPage(password, str_password_3);
            //антиБОТ
            System.Threading.Thread.Sleep(10304);

            password.SendKeys(OpenQA.Selenium.Keys.Enter);

            //----------------вывод в программу----------------
            textBox1.AppendText("Эл. адрес: " + str_email + "\n");
            textBox1.AppendText("Имя и Файмилия: " + str_name + "\n");
            textBox1.AppendText("Имя пользователя: " + str_username + "\n");
            textBox1.AppendText("Пароль: " + str_password + "\n");
            //----------------вывод в файл----------------
            fout.WriteLine("Эл. адрес: " + str_email + "\n");
            fout.WriteLine("Имя и Файмилия: " + str_name + "\n");
            fout.WriteLine("Имя пользователя: " + str_username + "\n");
            fout.WriteLine("Пароль: " + str_password + "\n");


            button3.Enabled = true;
        }