Vladimir Bosyi Vladimir Bosyi - 3 years ago 108
Java Question

How to send cookies with selenium webdriver?

Every time when I run my test first step is log in and than I get to desire page. If run this test often log in operation takes a lot of time.

How can I pass log in operation?

Using Chrome and Firefox drivers, java language.

Answer Source

Create cookies using the Java API as follows:

Cookie ck = new Cookie("name", "value");

Create cookies using the Python API as follows:

driver.add_cookie({'name': 'foo', 'value': 'bar'})
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download