Selenium Webdriver + PhantomJS remains at about:blank for a specific site

后端 未结 5 1457
星月不相逢
星月不相逢 2020-12-03 21:45

I am trying to use PhantomJS with Selenium Webdriver and got success but for a specific website I see that it does not navigate to the URL. I have tried it with both Python

相关标签:
5条回答
  • 2020-12-03 21:51

    Ran into this issue on an application quite abruptly after running phantomjs 1.9.7 for months without incident. The solution? Update phantomjs to 2.0.0.

    0 讨论(0)
  • 2020-12-03 21:52

    Following is a complete code solution for c# -

    PhantomJSDriverService service = PhantomJSDriverService.CreateDefaultService();
    service.IgnoreSslErrors = true;
    service.LoadImages = false;
    service.ProxyType = "none";
    
    driver = new PhantomJSDriver(service);
    
    0 讨论(0)
  • 2020-12-03 22:01

    For me, the solution was as follows:

    var service = PhantomJSDriverService.CreateDefaultService();
    service.SslProtocol = "tlsv1"; //"any" also works
    
    driver = new PhantomJSDriver(service);
    

    I have no idea why the default sslv3 will not work. If you are sure the SSL certificates are valid, it is quite recommended not to ignore errors to protect against malicious certificates.

    Update: For a very good explanation why SslProtocol should now be set to tlsv1 instead of the default sslv3, please take a look at the excellent cross link provided below by @Artjom B.

    0 讨论(0)
  • 2020-12-03 22:04

    It seems I have found a solution to this. The problem was an SSL handshake problem. By passing
    '--ignore-ssl-errors=true' as a service_args to phantomjs solves the issue.

    Thanks

    0 讨论(0)
  • 2020-12-03 22:11

    this worked for me:

    DesiredCapabilities capabilities = DesiredCapabilities.phantomjs();
    capabilities.setJavascriptEnabled(true);
    capabilities.setCapability(PhantomJSDriverService.PHANTOMJS_CLI_ARGS, new String[] {"--web-security=no", "--ignore-ssl-errors=yes", "--ssl-protocol=tlsv1"});
    driver = new PhantomJSDriver(capabilities);
    
    0 讨论(0)
提交回复
热议问题