0

I run simple selenium code on my linux server but it return that error

selenium.common.exceptions.WebDriverException: Message: Failed to start browser:
other os error

My python selenium code is this-

from pyvirtualdisplay import Display
from selenium import webdriver

display = Display(visible=0, size=(800, 600))
display.start()
browser = webdriver.Firefox()
browser.get('http://www.google.com')
browser.save_screenshot('screenie.png')
browser.quit()

display.stop()

And I also used firefox headless code but it return same error.

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
vipul gangwar
  • 313
  • 1
  • 4
  • 16

1 Answers1

1

As you are using Display from pyvirtualdisplay you need to download the GeckoDriver binary from this site, place it anywhere within your system and explicitly mention the location of the GeckoDriver binary as per the following line of code to initiate the Web Browser Client :

browser = webdriver.Firefox(executable_path=r'C:\path\to\geckodriver.exe')
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • you can also place geckodriver anywhere on your PATH and not worry about specifying the location in code. This also has nothing to do with pyvirtualdisplay. – Corey Goldberg Feb 06 '18 at 15:05