Announcing the v6.1.0 release of Selenium Library !!!
SeleniumLibrary 6.1.0 is a new release with some enhancements around timeouts, broadening edge support and removing deprecated Opera support, and some bug fixes. Major enhancements include the ability to set the Page Load Timeout and set the duration of mouse movements within Action Chains, some clarification within the timeout documentation, and enhanced Edge webdriver support under Linux. For all the changes check out the release notes for v6.1.0.
I want to thank the following people who have helped get this release out: @0xLeon, @robinmatz, @johnpp143, Dave Martin, @tminakov, Pekka Klärck, @remontees, @dotlambda, @DetachHead, Jani Mikkonen, Tatu Aalto, Lassi Heikkinen, Lisa Crispin, Yuri Verweij, and Robin Matz
One can install the latest version with
pip install --upgrade robotframework-seleniumlibrary
or use
pip install robotframework-seleniumlibrary==6.1.0
to specify installing the 6.1.0 version.
2 Likes
I followed âHow To Setup Robot Framework For Test Automation On Windowsâ by
Rommel Malqued ¡
I create a robot file. E.g. Login.robot he describes:
*** Settings ***
Library SeleniumLibrary
*** Test Cases ***
Login
Open Browser https://www.saucedemo.com/ chrome
Maximize Browser Window
Wait Until Element Is Visible id:user-name
Input Text id:user-name standard_user
Input Password id:password secret_sauce
Click Element id:login-button
Sleep 5s
Close Browser
Ran the above Login.robot in
PyCharm 2023.1 (Community Edition)
Build #PC-231.8109.197, built on March 29, 2023
Runtime version: 17.0.6+10-b829.5 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 11.0
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 20
Non-Bundled Plugins:
robocorp.lsp.intellij (1.10.1)
I get the following error
Importing library âSeleniumLibraryâ failed
This is the versions I have installed
robotframework-seleniumlibrary==6.1.0
selenium==4.9.0
requirements.txt file for project
Appium-Python-Client==2.9.0
async-generator==1.10
attrs==23.1.0
certifi==2022.12.7
cffi==1.15.1
charset-normalizer==3.1.0
decorator==5.1.1
docutils==0.19
exceptiongroup==1.1.1
h11==0.14.0
idna==3.4
kitchen==1.2.6
natsort==8.3.1
outcome==1.2.0
pycparser==2.21
PySocks==1.7.1
requests==2.30.0
robotframework==6.0.2
robotframework-appiumlibrary==2.0.0
robotframework-pabot==2.15.0
robotframework-pythonlibcore==4.1.2
robotframework-requests==0.9.4
robotframework-seleniumlibrary==6.1.0
robotframework-stacktrace==0.4.1
selenium==4.9.0
six==1.16.0
sniffio==1.3.0
sortedcontainers==2.4.0
trio==0.22.0
trio-websocket==0.10.2
urllib3==1.26.15
wsproto==1.2.0
@gordongilbert There is a bit of project configuration with PyCharm and the necessary configuration depends upon a few factors. Are you executing the script via the PyCharm run menu/button? What paramaters are set under the run configuration setup? Are you running using a virtualenv (which is separate from the virtual machine)?
One helpful hint to understanding to how you have configured and how PyCharm is running it is to look around that error message Importing library âSeleniumLibraryâ failed
. There should be a listing of directories - this being the PYTHONPATH - that the robot script is looking in. If the path to the Python for which you have listed here the packages installed is not there then you need to configure the Python interpreter (what other might call the Python executable) either under the run configurations or under PyCharm > Preferences > <Project Settings> .
I was running it from the run icon inside of my Login.robot script line 4 â*** Test Cases ***â
*** Settings ***
Library SeleniumLibrary
*** Test Cases ***
Login
Open Browser https://www.saucedemo.com/ chrome
Maximize Browser Window
Wait Until Element Is Visible id:user-name
Input Text id:user-name standard_user
Input Password id:password secret_sauce
Click Element id:login-button
Sleep 5s
Close Browser
Today I ran it and it passes. I donât understand what changed to make it work.
Glad to hear it is now working. A few of debugging tips that might be good to keep in mind in case you have issue in the future âŚ
- Pay attention to error messages, especially those which occur at the very beginning of an execution. Robot can display what we call non-fatal errors. A library failing to import is one such one. You might execute a test and the output will scroll by fairly quickly. So these initial errors might scroll by without notice and the script will continue to execute.
- PyCharm has settings which will affect the execution environment. It is good to understand how the run configurations (menu item Run > Edit ConfigurationsâŚ) and project settings (PyCharm > Preferences > <Project Settings>) work.
I feel like I am going in circles with this.
Importing library âSerialLibraryâ works for
C:\Users\gordo\PycharmProjects\RobotframeworkPi3B\venv\Login.robot
But not for a different file (C:\Users\gordo\PycharmProjects\RobotframeworkPi3B\venv\Boot.robot) in the same project with File>Settings>Languages & Frameworks>Robot Framework (Project)
Language Server Python as C:\Users\gordo\AppData\Local\Programs\Python\Python310\python.exe
PYTHONPATH as [âC:/Users/gordo/PycharmProjects/RobotframeworkPi3Bâ].
I donât see PyCharm > Preferences > with my version of PyCharm.
Started: C:\Users\gordo\PycharmProjects\RobotframeworkPi3B\venv\Boot.robot
[ERROR] Error in file âC:\Users\gordo\PycharmProjects\RobotframeworkPi3B\venv\Boot.robotâ on line 2: Importing library âSerialLibraryâ failed: ModuleNotFoundError: No module named âSerialLibraryâ
Traceback (most recent call last):
None
PYTHONPATH:
C:\Users\gordo\AppData\Roaming\JetBrains\PyCharmCE2023.1\plugins\robotframework-intellij\lib\robotframework_debug_adapter
C:\Users\gordo\PycharmProjects\RobotframeworkPi3B
C:\Users\gordo\AppData\Roaming\JetBrains\PyCharmCE2023.1\plugins\robotframework-intellij\lib
C:\Users\gordo\AppData\Roaming\JetBrains\PyCharmCE2023.1\plugins\robotframework-intellij\lib\robotframework_ls\vendored
C:\Users\gordo\AppData\Local\Programs\Python\Python310\python310.zip
C:\Users\gordo\AppData\Local\Programs\Python\Python310\DLLs
C:\Users\gordo\AppData\Local\Programs\Python\Python310\lib
C:\Users\gordo\AppData\Local\Programs\Python\Python310
C:\Users\gordo\AppData\Local\Programs\Python\Python310\lib\site-packages
[ ERROR ] Error in file âC:\Users\gordo\PycharmProjects\RobotframeworkPi3B\venv\Boot.robotâ on line 2: Importing library âSerialLibraryâ failed: ModuleNotFoundError: No module named âSerialLibraryâ
Traceback (most recent call last):
None
PYTHONPATH:
C:\Users\gordo\AppData\Roaming\JetBrains\PyCharmCE2023.1\plugins\robotframework-intellij\lib\robotframework_debug_adapter
C:\Users\gordo\PycharmProjects\RobotframeworkPi3B
C:\Users\gordo\AppData\Roaming\JetBrains\PyCharmCE2023.1\plugins\robotframework-intellij\lib
C:\Users\gordo\AppData\Roaming\JetBrains\PyCharmCE2023.1\plugins\robotframework-intellij\lib\robotframework_ls\vendored
C:\Users\gordo\AppData\Local\Programs\Python\Python310\python310.zip
C:\Users\gordo\AppData\Local\Programs\Python\Python310\DLLs
C:\Users\gordo\AppData\Local\Programs\Python\Python310\lib
C:\Users\gordo\AppData\Local\Programs\Python\Python310
C:\Users\gordo\AppData\Local\Programs\Python\Python310\lib\site-packages
Boot
System Boots | FAIL |
Parent suite setup failed:
No keyword with name âAdd Portâ found.
Verify RPI IP Address | FAIL |
Parent suite setup failed:
No keyword with name âAdd Portâ found.
Boot | FAIL |
Suite setup failed:
No keyword with name âAdd Portâ found.
Also suite teardown failed:
No keyword with name âDelete All Portsâ found.
2 tests, 0 passed, 2 failed
Output: C:\Users\gordo\PycharmProjects\RobotframeworkPi3B\log\output.xml
[FAIL (+0.01s)] No keyword with name âAdd Portâ found.
[FAIL] No keyword with name âDelete All Portsâ found.
Log: C:\Users\gordo\PycharmProjects\RobotframeworkPi3B\log\log.html
Report: C:\Users\gordo\PycharmProjects\RobotframeworkPi3B\log\report.html
Robot Run Terminated (code: 0)
Hi Gordon,
This thread is about SeleniumLibrary not SerialLibrary, so you might not get much help here. Try posting a new thread in the main forum.
Also as a tip put the log text between two lines that contain only 3 backticks (`), as it will make it easier for people to read.
```
```
Dave.
@gordongilbert It is odd that it works for one but not the other. Checking I see that PyCharm under Windows you find the the project settins under File > Settings
Also a few steps just to verify/check out your setup
First open a command prompt under Windows and type
python -c "import os, sys; print(os.path.dirname(sys.executable))"
This will print out where Python is and I would expect it to be C:\Users\gordo\AppData\Local\Programs\Python\Python310
Next start the python interactive prompt by typing at the command prompt python
and press enter. Then at the Python prompt type import SerialLibrary
. I would expect it to come right back with another Python interactive promt >>>
. But if there are errors then those should be resolved. Oddly though again if it works for one robot file and not the other ⌠well I wouldnât expect any errors in this test.