Answer the question
In order to leave comments, you need to log in
How to get cookies from the site and use them in other sessions?
Hello, tell me how can I get cookies and use them later in Selenium Webdriver. The task is as follows:
- I went to https://vk.com/
- I logged in manually
- I got cookies
- I restarted the driver (in order to clear cookies)
- I went to https://vk.com/
- I logged in by adding cookies.
My attempts are receiving cookies:
remixlang:0
remixdt:0
remixsid: ....fsadgwgrge41231241r...
remixsslsid:1
remixflash:25.0.0
remixscreen_depth:24
remixseenads:1
driver.Quit();
driver = null;
driver = new FirefoxDriver();
driver.Manage().Cookies.DeleteAllCookies();
foreach (Cookie ck in cookie)
{
try
{
driver.Manage().Cookies.AddCookie(ck);
}
catch (Exception ex)
{
textBox1.Text += ex.ToString() + Environment.NewLine;
}
}
driver.Navigate().GoToUrl("https://vk.com/");
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question