I use Selenium and python to do some web scraping work. The program works fine on my local machine. I now want to run the scraping job on my university's HPC cluster. I use Selenium with Firefox. I have install all modules and Firefox driver.
from selenium import webdriver
browser = webdriver.Firefox() # open firefox
browser.get(url)
After the second line, HPC opened one XQuartz window of Firefox (I am using Mac), and one line Traceback (see full traceback at the bottom):
selenium.common.exceptions.WebDriverException: Message: connection refused
This is not what I want. I want the HPC run the python program without opening XQuartz locally. I am very new to both selenium and python. So I probably misused selenium. I also tried requests
module. It is fine, but I need to click something.
Full traceback. cz93
is my username on the server, and ccPython
is the directory containing my python virtual environment.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/c/cz93/ccPython/lib/python3.6/site-packages/selenium/webdriver/firefox/webdriver.py", line 162, in __init__
keep_alive=True)
File "/home/c/cz93/ccPython/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 154, in __init__
self.start_session(desired_capabilities, browser_profile)
File "/home/c/cz93/ccPython/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 243, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/home/c/cz93/ccPython/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 312, in execute
self.error_handler.check_response(response)
File "/home/c/cz93/ccPython/lib/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: connection refused