0

I'm trying to learn web test automation with Selenium and I'm facing the following issue: I created a virtual environment and installed all python libraries needed, it might be important to mention that I want to use Robot Framework with the SeleniumLibrary. I use PopOS, so I downloaded the appropriate geckodriver to work with the Firefox installation that comes preinstalled in the OS. I wrote a basic script based on the example provided by the SeleniumLibrary developers and ran it. Then I got the error Expected browser binary location, but unable to find binary in default location, no 'moz:firefoxOptions.binary' capability provided, and no binary flag set on the command line. So I'm failing to open the browser. What is weird to me is that the firefox executable is in /usr/bin as expected, so I have no clue on what I could do in this situation. I'm using the latest available stable versions of the webdrivers and browser.

I thought that the issue might be the virtual environment trying to access something that it is not allowed, so I tried changing the access permissions of the firefox executable but nothing changed.

EDIT: I tried adding the path to the Firefox binary using FirefoxOptions from selenium webdriver as below:

from selenium import webdriver
from selenium.webdriver import FirefoxOptions


options = FirefoxOptions()
options.binary=r"/usr/bin/firefox"
browser = webdriver.Firefox(options=options)
browser.get('https://google.com')

But still no success... Now it returns InvalidArgumentException: Message: binary is not a Firefox executable

Again, the file I'm pointing to is a Firefox executable and opens it normally.

Vini
  • 1
  • 1

1 Answers1

1

You probably need to specify binary for the browser.

from selenium.webdriver import FirefoxOptions
from selenium import webdriver

options = FirefoxOptions()
options.binary = '/path/to/binary'
driver = webdriver.Firefox(options=opts)
Reb0rN
  • 17
  • 3
  • I might try this later. I guess I'll have to use a python scripts for that as I tried using the keywords included in the SeleniumLibrary for Robot before. – Vini Jul 14 '23 at 12:58
  • Yeah, it didn't work. I added more information to the question. Thank you for your answer nonetheless. – Vini Jul 14 '23 at 22:10