Relative Content

Tag Archive for javaselenium-webdriverselenium-chromedriver

Selenium org.openqa.selenium.InvalidCookieDomainException: invalid cookie domain

public static void main(String[] args) { Date tomorrow = new Date(new Date().getTime() + 24 * 3600 * 1000); Cookie cookie = new Cookie.Builder(“lang”, “en”) .domain(“.example.com”) .expiresOn(tomorrow) .path(“/”) .build(); driver.manage().addCookie(cookie); driver.get(“http://example.com”); } The last line results in the invalid cookie domain exception: I have tried multiple variations and different domains. What am I doing wrong here? […]