I'm new to selenium and I'm trying to run firefox webdriver in virtual display.
Firefox: 52.5.1
geckodriver: 0.19.1
Here's my entire code
from selenium import webdriver
from selenium.webdriver import FirefoxProfile
from pyvirtualdisplay import Display
try:
display = Display(visible=0, size=(800, 600))
display.start()
ffprofile = FirefoxProfile()
ffprofile.set_preference("dom.webnotifications.enabled", False)
driver = webdriver.Firefox(ffprofile)
driver.get('https://www.91mobiles.com')
print driver.current_url
driver.close()
except Exception as e:
print e
And it's giving me exception:
Message: connection refused
I also came across similar questions but unable to fix the issue. Please provide some suggestions.