junche4 / selenium-vba

Automatically exported from code.google.com/p/selenium-vba
0 stars 0 forks source link

PhantomJS Browser does not support cookies #109

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Operating system and version (32/64bit) : Windows 7 64bit
.Net Framework version : 4.5
Office name and version(32/64bit) : Office Professional 2010 64bit
Browser name and version : PhantomJS 1.9.7
SeleniumWrapper version : v1.0.21.1

What steps will reproduce the problem with a public website ?
1. Set objWebDriver = New SeleniumWrapper.WebDriver
2. objWebDriver.Start "phantomJS", "http://amazon.co.uk"
3. objWebDriver.createCookie "testCookie=yes", "max_age=60"

What is the expected output? What do you see instead?
phantomJS is supposed to have cookie handling enabled by default, so the cookie 
should be created. Instead an exception is thrown:
Description: "Method <createCookie> failed!
SeleniumException: WebDriver exception thrown"
HelpContext: 1000440
Number: -2146232832
Source: "SeleniumWrapper"

Please provide any additional information below.
Changing browser from "phantomJS" to "firefox" the cookie is created.

Original issue reported on code.google.com by vi...@trulymadlydeeply.biz on 16 Oct 2014 at 5:04

GoogleCodeExporter commented 9 years ago
You need to open the page before setting the cookie (It seems to be a 
requirement with the phantomJS driver):
1. Set objWebDriver = New SeleniumWrapper.WebDriver
2. objWebDriver.Start "phantomJS", "http://amazon.co.uk"
3. objWebDriver.Open "/"
4. objWebDriver.createCookie "testCookie=yes", "max_age=60"

Original comment by florentbr on 22 Oct 2014 at 7:43