1

Checking whether a website loads in opera using selenium with python, using the code below:

def test_opera_compatability(self):
    driver = webdriver.Opera("functional_tests/operadriver")
    driver.get("https://www.google.com/")
    driver.quit()

It returns the following error:

Message: 'operadriver' executable needs to be in PATH.

Similar code for chrome works as intended, which looks like this:

def test_chrome_compatability(self):
    driver = webdriver.Chrome('functional_tests/chromedriver')
    driver.get("https://www.google.com/")
    driver.quit()
Avin Mathew
  • 336
  • 11
  • 25

1 Answers1

1

You can use the Key executable_path to pass the absolute path of the operadriver binary as follows:

def test_opera_compatability(self):
    driver = webdriver.Opera(executable_path='/path/to/functional_tests/operadriver')
    driver.get("https://www.google.com/")
    driver.quit()
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • @AvinMathew The question _heading_ and _description_ mentions of **operadriver** and **opera** respectively, where as your code trials were for **geckodriver**. However I canged the code a bit. Checkout the updated answer and let me know the status. – undetected Selenium Nov 28 '19 at 09:46
  • sorry for the misunderstanding, I made a typo when typing the code, I updated the code in question thanks for the info – Avin Mathew Nov 28 '19 at 09:50
  • yes i tried it solved it but gives me a new error "your Firefox profile cannot be loaded. It may be missing or inaccessible" – Avin Mathew Nov 28 '19 at 10:09
  • @AvinMathew Great, so your initial error of _Message: 'operadriver' executable needs to be in PATH._ is resolved now. Can you raise a new question as per your new requirement please? Stackoverflow contributors will be happy to help you out. – undetected Selenium Nov 28 '19 at 10:11
  • I have less than 15 reputations, I will do it once I have enough reputations. – Avin Mathew Nov 28 '19 at 11:45