private void button2_Click(object sender, EventArgs e) { textBox1.Clear(); webElement = Brauser.FindElement(By.CssSelector("#l_aud a")); webElement.SendKeys(OpenQA.Selenium.Keys.Enter); System.Threading.Thread.Sleep(8000); List <IWebElement> News1 = Brauser.FindElements(By.CssSelector("div.audio_row__performer_title")).ToList();//#feed_wall .wall_text a List <string> ff = new List <string>(); for (int i = 0; i < News1.Count; i++) { textBox1.AppendText(News1[i].Text + "\n"); ff.Add(News1[i].Text + "\n"); } File.Delete(@"D:\Laboratory_works\Музыка.txt"); FileInfo file = new FileInfo(@"D:\Laboratory_works\Музыка.txt"); StreamWriter sr = file.CreateText(); sr.Close(); WriteFile file2 = new WriteFile(); string path = @"D:\Laboratory_works\Музыка.txt"; file2.Write(ff, path); MessageBox.Show("Музыка записаны"); }
private void button1_Click(object sender, EventArgs e) { Brauser = new OpenQA.Selenium.Chrome.ChromeDriver(); Brauser.Manage().Window.Maximize(); System.Threading.Thread.Sleep(5000); Brauser.Navigate().GoToUrl("http://google.com"); webElement = Brauser.FindElement(By.Id("lst-ib")); System.Threading.Thread.Sleep(5000); webElement.SendKeys("vk.com" + OpenQA.Selenium.Keys.Enter); webElement = Brauser.FindElement(By.LinkText("ВКонтакте: Добро пожаловать")); webElement.Click(); System.Threading.Thread.SpinWait(6000); webElement = Brauser.FindElement(By.Id("index_email")); CeckKapcha(); webElement.SendKeys("380665846760" + OpenQA.Selenium.Keys.Enter); CeckKapcha(); webElement = Brauser.FindElement(By.Id("index_pass")); System.Threading.Thread.Sleep(6000); CeckKapcha(); webElement.SendKeys("1q2w3e4r5tAZ" + OpenQA.Selenium.Keys.Enter); CeckKapcha(); System.Threading.Thread.Sleep(1000); // webElement = Brauser.FindElement(By.Id("index_login_button")); CeckKapcha(); // webElement.SendKeys(OpenQA.Selenium.Keys.Enter); CeckKapcha(); System.Threading.Thread.Sleep(8000); CeckKapcha(); webElement = Brauser.FindElement(By.CssSelector("#l_gr a")); webElement.SendKeys(OpenQA.Selenium.Keys.Enter); System.Threading.Thread.Sleep(8000); webElement = Brauser.FindElement(By.CssSelector("#groups_list_search")); webElement.SendKeys("Донецк" + OpenQA.Selenium.Keys.Enter); System.Threading.Thread.Sleep(8000); List <IWebElement> News = Brauser.FindElements(By.CssSelector("a.group_row_title")).ToList();//#feed_wall .wall_text a List <string> ff = new List <string>(); for (int i = 0; i < News.Count; i++) { textBox1.AppendText(News[i].Text + "\n"); ff.Add(News[i].Text + "\n"); } File.Delete(@"D:\Laboratory_works\Group.txt"); FileInfo file = new FileInfo(@"D:\Laboratory_works\Group.txt"); StreamWriter sr = file.CreateText(); sr.Close(); WriteFile file2 = new WriteFile(); string path = @"D:\Laboratory_works\Group.txt"; file2.Write(ff, path); MessageBox.Show("Группы записаны"); }