I\'m trying to add cookies to a link before I open it with webdriver but it keeps giving me this error:
org.openqa.selenium.UnableToSetCookieException
You are unable to do this because the WebDriver spec requires that you have the browser landed at the domain you are trying to set cookies for.
The work-around as mentioned is to go to the page prior to setting the cookie. But that causes some issues:
This unfortunately prevents 2 key use cases:
The webdriver spec clearly needs to take this into account. I have opened an issue here:
https://github.com/w3c/webdriver/issues/1238
Give it some votes. All browsers should start carrying a way to handle this.