L
L
LordOftheCode2021-08-13 12:54:50
C++ / C#
LordOftheCode, 2021-08-13 12:54:50

What kind of cookie data to pass to selenium?

There is a code, I need to go to Instagram using cookies, I unloaded all the cookies using the extension,
it turned out to be a large text file, it has a lot of data (value , id , name, etc.)
this code turned out, I tried to transfer data to cookie 2 name , value but getting an invalid cookie error

private void button1_Click(object sender, EventArgs e)
        {

            driver = new ChromeDriver();

            driver.Manage().Cookies.AddCookie(new Cookie("csrftoken", "dwJXBPBe403WDk1PKE8ndUrEhs8fKzJc"));

            driver.Navigate().GoToUrl("https://www.instagram.com");



        }

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
soremix, 2021-08-13
@LordOftheCode

First go to the site, then insert cookies
ps: csrf does not apply to the session

L
LordOftheCode, 2021-08-13
@LordOftheCode

driver.Manage().Cookies.AddCookie(new Cookie("sessionid", "48257564335%3AxqVRD0uGeXxIor%3A25"));

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question