0

I am trying to load an HTTPS URL which works fine with the FirefoxDriver, but when I use HTMLUNIT Driver, I'm getting below error when trying to access the first element on the webpage.

org.openqa.selenium.NoSuchElementException: Unable to locate element

When I use webDriver.getCurrentUrl(), I got the page URL saying "about:blank" and webDriver.getPageSource() produces empty HTML content (with HTMLUNIT). I have done a lot of extensive research into this and have already tried these suggested techniques:

  • HTMLUNIT with no proxy
  • webClient.getOptions().setInsecureSSL(true)
  • Using the IP address in the URL instead of the DNS name

I want to eventually run this test on Jenkins, so have tried various HTTPS proxy and port settings on Jenkins to no prevail. If anyone has any suggestions on how to resolve this issue, it would be greatly appreciated.

NarendraR
  • 7,577
  • 10
  • 44
  • 82
James Meade
  • 1,147
  • 5
  • 22
  • 46
  • It may be because of SSL handshake or JavaScript error. Do you have other exceptions? You need to provide more details, for others to reproduce it. – Ahmed Ashour Jul 25 '17 at 10:44
  • HtmlUnit does not use the usual proxy setting of the JVM. Have a look at http://htmlunit.sourceforge.net/gettingStarted.html on how to configure your proxy. – RBRi Jul 25 '17 at 10:47
  • There aren't any other exceptions, there doesn't appear to be any thrown and caught anywhere else. As regards to the proxy setting, a HTTP URL works with the current settings, it's only with HTTPS. Would this make a different to what you were suggesting RBRi? – James Meade Jul 25 '17 at 13:35
  • Sounds strange. Any option to do a test with HtmlUnit only (like the simple first example on page http://htmlunit.sourceforge.net/gettingStarted.html? – RBRi Jul 25 '17 at 15:25
  • There should be no difference between http and https from the proxy settings – RBRi Jul 25 '17 at 15:26
  • Perhaps there is another reason why the webpage isn't loading then. – James Meade Jul 25 '17 at 15:27

0 Answers0