But im getting " Evaluating expression ‘sys.modules[‘selenium.webdriver’].EdgeOptions()’ failed: AttributeError: module ‘selenium.webdriver’ has no attribute ‘EdgeOptions’" when i try to open the browser
Open Browser about:blank edge options=add_argument("--headless=new")
noting also that the option for headless though Chromium-based browsers, like Edge, has been upgrade for just --headless to --headless=new [Reference].
That error is fairly straight forward. Unless you have something patching selenium, which is possible but doubtful, it would seem that the Python instance running on that docker machine, although the container may have 4.2.0 installed, has a 3.x or prior instance installed. EdgeOptions got introduced with Selenium v4.0.
*** Settings ***
Library SeleniumLibrary
*** Test Cases ***
Get version of selenium used by the Python running this robot script
Open Browser about:blank Chrome
Evaluate print(selenium.__version__) selenium
Evaluate print(sys.exec_prefix) sys
and it gives to me the version I see when running the same Python instance, in this case a virtualenv, that I am expecting. Might be worth trying this right before your line that is failing.
[Edited: I add in the second Evaluate line which then prints out the “prefix” or directory of where the python which executed this script is. May be useful in debugging.]
You are close to finding issue. It seems you just need to figure out or verify a few more configuration. Here are some questions that might help you …
Are you installing using the requirement file (I don’t see it there above)? What is the version for selenium given within the requirements file (is it pinned at 4.3.0 or something else)? And if you are installing with requirements are you sure that is the same Python that is executing the script? This last question is key. I suspect - although it might not be the case, only you can investigate - that the docker image has a Python already installed. So that means you need to check the versions and locations of which Python is executing. You might be able to add the following to the configuration script
which python
or maybe
which python3
Some other good informative or debugging scripts could include
Running this Evaluate print(selenium.version), selenium from script gives: 3.141.0
My requirement file contains :
robotframework==4.1.3
selenium==4.2.0
Call used is : RUN pip3 install -U -r requirements.txt
i m still cant figure out the problem of getting this old version for selenium
i have tried to remove and install the new version but still no luck to update selenium
According to your log, pip3 successfully installed robotframework-seleniumlibrary-5.1.3 and selenium-4.2.0, so I’m not sure why you’re still seeing selenium 4.13.0?
Are you using a python virtual environment?
Another thing you could check is the path, try adding this line to your robot file:
Log %{PATH}
Perhaps you have 2 python versions installed? and the pip3 command is installing the modules and libraries in one python version and robot is running from another?