问题
I am trying to use Selenium's Chromedriver to log in to a website which has cookies enabled. I got a message from the server that the browser has cookies disabled. How can I enable cookies in Chromedriver?
回答1:
ChromeDriver has cookie be enabled by default.
Please try the following steps:
Use FirefoxDriver/IEDriver, see what the site says.
Manually open a Chrome browser, see what the site says.
Try open whatismybrowser.com with ChromeDriver opened browser, see what it tells you.
If your site says cookie not enabled for FirefoxDriver/IEDriver/Manually opened Chrome, and whatismybrowser.com says your ChromeDriver opened browser has cookie enabled, then clearly something is wrong with your site, please try debug your site.
来源:https://stackoverflow.com/questions/19211006/how-to-enable-cookies-in-chromedriver-with-webdriver