2

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.

Maccaroni
  • 45
  • 2
  • 8
  • 1
    Possible duplicate of [How to fix "WebDriverException: Message: connection refused"?](https://stackoverflow.com/questions/47920639/how-to-fix-webdriverexception-message-connection-refused) – undetected Selenium Jan 24 '18 at 13:33
  • I followed the link that you provided but nothing seems to work. It's still throwing the same exception. I also added time.sleep(10) just to test if it'll work but it didn't. – Maccaroni Jan 24 '18 at 13:59
  • I solutation the same problem without doing anything, expect reboot. – Waket Zheng Aug 28 '19 at 06:42

0 Answers0