I'm setting some capabilities for PhantomJsDriver
.
DesiredCapabilities caps = new DesiredCapabilities();
caps.setJavascriptEnabled(true);
caps.setCapability("cssSelectorsEnabled", false);
caps.setCapability("applicationCacheEnabled", true);
caps.setCapability("acceptSslCerts",true);
caps.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY,phantomJsPath);
this.driver = new PhantomJSDriver(caps);
Then, I check what capabilities the driver is using:
System.out.println(driver.getCapabilities());
Output:
Capabilities [{
platform=XP,
acceptSslCerts=false,
javascriptEnabled=true,
browserName=phantomjs,
rotatable=false,
driverVersion=1.1.0,
locationContextEnabled=false,
version=1.9.7,
cssSelectorsEnabled=true,
databaseEnabled=false,
handlesAlerts=false,
browserConnectionEnabled=false,
proxy={proxyType=direct},
nativeEvents=true,
webStorageEnabled=false,
driverName=ghostdriver,
applicationCacheEnabled=false,
takesScreenshot=true}]
It shows:
cssSelectorsEnabled=true,
applicationCacheEnabled=false,
acceptSslCerts=false
Why is the driver running without the capabilities I set?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…