Why won't PhantomJSDriver use the capabilities I set?

后端 未结 2 1011
伪装坚强ぢ
伪装坚强ぢ 2020-12-05 21:36

I\'m setting some capabilities for PhantomJsDriver.

DesiredCapabilities caps = new DesiredCapabilities();
caps.setJavascriptEnabled(true);
caps.         


        
相关标签:
2条回答
  • 2020-12-05 21:58

    With phantomjsdriver-1.1 I had to pass the follow arguments to get this to work.

    cliArgsCap.add("--web-security=no");
    cliArgsCap.add("--ignore-ssl-errors=yes");
    
    0 讨论(0)
  • 2020-12-05 22:00

    PhantomJS uses different mechanism in setting capabilities

    static ArrayList<String> cliArgsCap = new ArrayList<String>();
    capabilities = DesiredCapabilities.phantomjs();
    cliArgsCap.add("--web-security=false");
    cliArgsCap.add("--ssl-protocol=any");
    cliArgsCap.add("--ignore-ssl-errors=true");
    capabilities.setCapability("takesScreenshot", true);
    capabilities.setCapability(
        PhantomJSDriverService.PHANTOMJS_CLI_ARGS, cliArgsCap);
    capabilities.setCapability(
        PhantomJSDriverService.PHANTOMJS_GHOSTDRIVER_CLI_ARGS,
            new String[] { "--logLevel=2" });
    this.driver = new PhantomJSDriver(capabilities);
    

    For more information about its command line, you could reference http://phantomjs.org/api/command-line.html

    0 讨论(0)
提交回复
热议问题