Robot Framework Webdriver Manager - Not able to get driver path when executed with other keywords

1.7k views Asked by At

I am using webdriver-manager under Robot Framework to automatically manage drivers. I have created a python library where method is defined to get the driver path (see the code snippet below):

#BrowserDriverManager.py
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
def get_browser_driver_path():
    driver_path = ChromeDriverManager().install()
    return  driver_path

I have imported python library under Robot Framework resource and created a keyword for opening application (see the code snippet below).

Open application using browser
    ${url}=    Generate URL for web request via browser
    ${driverPath}=      get_browser_driver_path
    Create Webdriver    ${BROWSER}      executable_path=${driverPath}
    Go To   ${url}

Now when I am executing test case (under Robot Framework) with only one keyword "Open application using browser" then test executed successfully. See the Success attachment.enter image description here However if in the test case there are few keywords before "Open application using browser" then test failed under "Open application using browser". See the Failure attachment.enter image description here

Failure is happening during the execution of get_browser_driver_path method. I am not sure if keywords executed before having any impact. Does anyone faced this kind of issue before where keyword execution worked fine in isolation but not in group?

1

There are 1 answers

0
rasjani On

Error is most likely from your environment variables as the error is ValueError: unknown locale: en-US which python doesn't seem to recognize.

I have something like these in my environment:

LC_ADDRESS=en_US.UTF-8
LC_ALL=en_US.UTF-8
LC_COLLATE=en_US.UTF-8
LC_CTYPE=en_US.UTF-8
LC_IDENTIFICATION=en_US.UTF-8
LC_MEASUREMENT=en_US.UTF-8
LC_MESSAGES=en_US.UTF-8
LC_MONETARY=en_US.UTF-8
LC_NAME=en_US.UTF-8
LC_NUMERIC=en_US.UTF-8
LC_PAPER=en_US.UTF-8
LC_TELEPHONE=en_US.UTF-8
LC_TIME=en_US.UTF-8