private void button3_Click(object sender, EventArgs e)
{
var chromeOptions = new ChromeOptions();
chromeOptions.AddArguments("headless");
driver = new ChromeDriver();
driver.Navigate().GoToUrl($"https://www.instagram.com/accounts/login/?hl=ru&next=%2Faliev.mihack%2F&source=desktop_nav");
Thread.Sleep(1200);
driver.FindElement(By.XPath("//input[@class='_2hvTZ pexuQ zyHYP']")).Click();
var loginName = driver.FindElement(By.XPath("//input[@class='_2hvTZ pexuQ zyHYP focus-visible']")); // Поле для ввода Логина
string txtLogin = textBox2.Text;
loginName.SendKeys(txtLogin);
driver.FindElement(By.XPath("//input[@class='_2hvTZ pexuQ zyHYP']")).Click();
var n = driver.FindElement(By.XPath("//input[@class='_2hvTZ pexuQ zyHYP focus-visible']")); // Поле для ввода Пароля
string txtPassword = textBox3.Text;
n.SendKeys(txtPassword);
driver.FindElement(By.XPath("//button[@class='sqdOP L3NKy y3zKF ']")).Click(); // Клик на кнопку авторизации
Thread.Sleep(4000);
string txt = textBox5.Text;
driver.Navigate().GoToUrl(txt);
while (true)
{
driver.Navigate().Refresh();
var input = driver.FindElement(By.XPath("//textarea[@class='Ypffh']"));
input.Click();
Thread.Sleep(1200);
input = driver.FindElement(By.XPath("//textarea[@class='Ypffh focus-visible']"));
input.SendKeys(textBox4.Text);
Thread.Sleep(800);
input.Submit();
Thread.Sleep(1200);
}