[ALERT - 2016-01-16T02:22:00.898Z] Session [e6651a90-bbf7-11e5-9061-cff578894101] - page.onError - msg: ReferenceError: Can't find variable: data
:262 in error [WARNING - 2016-01-16T02:22:00.898Z] Session [e6651a90-bbf7-11e5-9061-cff578894101] - page.onError - stack: (anonymous function) (http://www.example.com/ns/common/jquery/jquery.cartActions.js?cd=0:205) o (http://www.example.com/images/common/jquery/jquery.latest.js:2) fireWith (http://www.example.com/images/common/jquery/jquery.latest.js:2) w (http://www.example.com/images/common/jquery/jquery.latest.js:4) d (http://www.example.com/images/common/jquery/jquery.latest.js:4) openUrl (:0) open (:280) (anonymous function) (:/ghostdriver/request_handlers/session_request_handler.js:495) _execFuncAndWaitForLoadDecorator (:/ghostdriver/session.js:212) _postUrlCommand (:/ghostdriver/request_handlers/session_request_handler.js:494) _handle (:/ghostdriver/request_handlers/session_request_handler.js:91) _reroute (:/ghostdriver/request_handlers/request_handler.js:61) _handle (:/ghostdriver/request_handlers/router_request_handler.js:78) :262 in error
^Domain edited out on purpose.
As per information from Can't find variable - PhantomJS, this particular error seems to be related to improper jailed execution of Javascript. The specifics of this issue and its connection to Java programming has left me confused.
In my Selenium program, the Javascript call is fairly simple and goes like:
((JavascriptExecutor) driver).executeScript("arguments[0].click();", buttonToClick);
The above line appears to be functioning correctly as other similar lines execute without any errors before encountering the aforementioned issue.
Even though I have tried several configurations with the PhantomJS driver initializer block below, I have not been able to resolve "acceptSslCerts":false under Session.NegotiatedCapabilities:
String[] cli_args = new String[]{"--debug=false", "--web-security=false", "--ssl-protocol=any", "--ignore-ssl-errors=true"};
DesiredCapabilities caps = DesiredCapabilities.phantomjs();
caps.setCapability(PhantomJSDriverService.PHANTOMJS_CLI_ARGS, cli_args);
caps.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, "/Users/richard/Downloads/phantomjs-2.0.0-macosx/bin/phantomjs");
driver = new PhantomJSDriver(caps);
Despite seeing that the arguments are indeed being passed in through the Console...
Jan 16, 2016 6:23:40 AM org.openqa.selenium.phantomjs.PhantomJSDriverService <init>
INFO: arguments: [--web-security=no, --ignore-ssl-errors=yes, --webdriver=33238, --webdriver-logfile=/Users/richard/YeezyBot/phantomjsdriver.log]
It's worth mentioning that everything runs smoothly with Firefox WebDriver.