Selenium Robot Framework
Введение | |
Установка | |
Пример теста с Selenium WedDriver | |
Похожие статьи |
Введение
Долгое время SeleniumLibrary была основной библиотека для UI тестов веб-приложений.
Документация
Установка
python -m pip install robotframework-seleniumlibrary
Collecting robotframework-seleniumlibrary Downloading robotframework_seleniumlibrary-5.1.3-py2.py3-none-any.whl (94 kB) |████████████████████████████████| 94 kB 1.6 MB/s Collecting selenium>=3.141.0 Downloading selenium-3.141.0-py2.py3-none-any.whl (904 kB) |████████████████████████████████| 904 kB 51.5 MB/s Collecting robotframework-pythonlibcore>=2.1.0 Downloading robotframework_pythonlibcore-2.2.1-py2.py3-none-any.whl (10 kB) Requirement already satisfied: robotframework>=3.1.2 in /home/andrei/robotframework/myvenv/lib/python3.9/site-packages (from robotframework-seleniumlibrary) (4.0.1) Collecting urllib3 Using cached urllib3-1.26.4-py2.py3-none-any.whl (153 kB) Installing collected packages: urllib3, selenium, robotframework-pythonlibcore, robotframework-seleniumlibrary Successfully installed robotframework-pythonlibcore-2.2.1 robotframework-seleniumlibrary-5.1.3 selenium-3.141.0 urllib3-1.26.4
Пример теста с Selenium WebDriver
Особенность синтаксиса Robot Framework заключается в том, что, между ключевым словом
и значением нужно ставить два пробела.
Например, между Library и SeleniumLibrary нужно ставить два пробела.
Создадим простой тест в файле
GoogleSearch.robot
*** Settings ***
Documentation Simple example using SeleniumLibrary.
Library SeleniumLibrary
*** Variables ***
*** Test Cases ***
This is sample test case
[documentation] Google test
[tags] regression
Open Browser http://www.google.com chrome
Close Browser
*** Keywords ***
robot -d results Tests/Google/FunctionalTestSuite/GoogleSearch.robot
============================================================================== GoogleSearch :: Simple example using SeleniumLibrary. ============================================================================== This is sample test case :: Google test DevTools listening on ws://127.0.0.1:64096/devtools/browser/b2618042-f0b5-4e41-976f-106fdd21d9v0 This is sample test case :: Google test | PASS | ------------------------------------------------------------------------------ GoogleSearch :: Simple example using SeleniumLibrary. | PASS | 1 test, 1 passed, 0 failed ============================================================================== Output: /home/andrei/robotframework/RobotFWTutorial/results/output.xml Log: /home/andrei/robotframework/RobotFWTutorial/results/log.html Report: /home/andrei/robotframework/RobotFWTutorial/results/report.html
firefox Results/report.html

Robot Framework
Более детальный отчёт находится в log.html
Автор статьи: Андрей Олегович
Robot Framework | |
Основы | |
Архитектура | |
RFBrowser | |
Selenium |