0

So for now I have just a small script with an issue that is running on my Ubuntu Windows Subsystem, but I can't make the script to run since I get a weird error beucase of geckodriver.

I have also tried the steps here, but it didn't work. Everything is running inside my virtual environment, python 3.6, latest version of selenium and geckodriver(from their website). This will be running on a server where Firefox won't be installed so that's why I'm using geckodriver and the instalation of Firefox is out of question.

from selenium import webdriver
geckodriver = '/home/user/test_env/geckodriver'

def test():
    options = webdriver.FirefoxOptions()
    options.add_argument('-headless')
    browser = webdriver.Firefox(executable_path=geckodriver, 
                                 firefox_options=options)

    browser.get('https://www.duckduckgo.com')
    browser.save_screenshot('test.png')

    browser.quit()

def main():
    # Try running the script
    test()


if __name__ == '__main__':
    main()
selenium.common.exceptions.SessionNotCreatedException: Message: Unable to find a matching set of capabilities

Error from the line

 webdriver.Firefox(executable_path=geckodriver, firefox_options=options)

Edit: I have installed Firefox on my machine and moved it to /usr/local/bin and gave it +x permissions and I've also moved geckodriver to /usr/local/bin but I am still getting the same error.

Julanu
  • 162
  • 2
  • 5
  • 15
  • Your script won't work without Firefox, Geckodriver is a 'link' between your Selenium tests and the browser. For more detail read [this](https://www.quora.com/Why-should-I-use-the-Gecko-Driver-in-Selenium-3-0) – Guilherme Marques Jun 06 '19 at 14:22
  • Yep. I was aware of that and I've installed Firefox into /usr/local/bin and gave it +x permission but I still have that error – Julanu Jun 06 '19 at 15:13

0 Answers0