简体   繁体   中英

Selenium Webdriver get cookies full domain in internet explorer

I am trying to obtain the Cookies from the whole domain of a site but I can't seem to get it. Here is my code:

Set<Cookie> cookies = driver.manage().getCookies();

    for (Cookie cookie : cookies) {
        System.out.println(cookie);
    }

This does what I want, however, I have a cookie that has another path value, and this snippet is not returning the correct cookie, any ideas?

Note: This works flawlessly on Chrome and Firefox, the browser in question is IE.

As far as my understanding and knowledge Internet explorer when opened with selenium maintain cookie and cache from earlier activities. At the time of initiating you can clean the instance.

capabilities = DesiredCapabilities.InternetExplorer();
capabilities.SetCapability("ie.ensureCleanSession", true);

ie.ensureCleanSession

When set to true, this capability clears the cache, cookies, history, and saved form data. When using this capability, be aware that this clears the cache for all running instances of Internet Explorer, including those started manually.

Please do tell me if this information is helpful

Thanks

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM