0

I am trying to set up and use HTMLUnit driver in Python 3. I believe I have the server running (v3.7.0) and believe the code should work based looking up other questions on here. I believe that the remote server uses port 4444 but my ISP locks that port down (along with basically every other port). Currently when I run the code I get a connection refused. Is this to do with the port being closed? Can I change the port to 8080 (which is open)?

from selenium import webdriver
driver = webdriver.Remote(desired_capabilities=webdriver.DesiredCapabilities.HTMLUNITWITHJS)
driver.get('http://www.google.com')

Current output:

urllib.error.URLError: <urlopen error [Errno 61] Connection refused>
Aiden
  • 309
  • 2
  • 16
  • Are you able to launch any other browser? Also is the server running on the same machine or a external machine? Because if server runs on same machine then port blocking may not matter – Tarun Lalwani Nov 23 '17 at 05:34
  • @TarunLalwani Yes, I can launch with Chrome and Safari with no issue but I would like to try HTMLUnit as it appears to be the fastest browser. Yes, the server is running on the same machine. I ran it by typing `java -jar selenium-server-standalone-3.7.0.jar` into the terminal window in Pycharm. – Aiden Nov 23 '17 at 17:01
  • when you say chrome works? Did you run it using `driver = webdriver.Remote(desired_capabilities=webdriver.DesiredCapabilities.CHROME)` – Tarun Lalwani Nov 24 '17 at 12:39
  • @TarunLalwani no I did not try and run chrome remotely. – Aiden Nov 28 '17 at 22:05
  • If you are doing it on a local machine then only thing that would block access is a firewall. ISP won't come into picture when you are testing on a local system – Tarun Lalwani Nov 29 '17 at 08:05

1 Answers1

0

From this Link:

You can use:

driver = webdriver.Remote("http://localhost:4444/wd/hub", webdriver.DesiredCapabilities.HTMLUNITWITHJS)
YourAboutMeIsBlank
  • 1,787
  • 3
  • 18
  • 27