I was trying to do a basic robot test case as below. Geckodriver was placed under Python37/Scripts folder and same is available under path.
*** Settings ***
Library SeleniumLibrary
*** Variables ***
${URL} https://www.google.com
${Browser} firefox
*** Test Cases ***
Testing with Browser
open browser ${URL} ${Browser}
Running above test case resulted in this error - Unable to open Firefox browser due to error - SessionNotCreatedException: Message: 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
I have red some previously answered queries to use absolute path of the firefox, can someone please help to get this done in my robot file ?..
Code:
*** Settings ***
Library SeleniumLibrary
*** Variables ***
${URL} https://www.google.com
${Browser} firefox
*** Test Cases ***
Testing with Browser
open browser ${URL} ${Browser}
The error is related to not finding the binary of Firefox, not geckodriver
, which you already solved.
To be sure firefox
is in the directories set in the PATH environment variable, you should open a Command Window/Terminal/Shell and try:
firefox --version
If not the expected version, and an error, the path to the binary must be given in Open Browser
option, or the correct directory listed in PATH environment variable.
You can use the option executable_path
, but be aware of this note in the Open Browser
documentation:
The executable_path argument is new in SeleniumLibrary 4.2.