一、安装?robotframework-seleniumlibrary
GitHub - robotframework/SeleniumLibrary: Web testing library for Robot Framework
(env)$ pip install --upgrade robotframework-seleniumlibrary
...
robotframework-seleniumlibrary-4.5.0 robotframework-selenium2library-3.0.0 ...
...
二、安装Selenium WebDriver
Selenium Client Driver — Selenium 4.0.0 documentation
你可以单独从selenium官方文档中单独下载想要的drivers,并放置在PATH下。
下载想要的selenium webdriver到 PATH下,如 ~/workspace-python/robot/env/bin
三、测试
- 右键Project -> New Resource
- Name填入比如:resources.robot,选择类型为Resource
- 单击resources.robot -> Library -> Name输入SeleniumLibrary,即完成SeleniumLibrary
- 右击resources.robot -> New User Keyword
- Name填入比如:Open Login Page
- 内容输入Open Browser?https://robotframework.org/demoapp chrome
- 右击Project -> New Suite
- Name 填入比如: Example,Type选择File,Format选择Robot,即完成Suite创建
- 右击Suite -> New Test Case
- Name填入?比如:Selenium Demo
- 内容添加Open Login Page
- 运行
*** Settings ***
Documentation A test suite for valid login.
...
... Keywords are imported from the resource file
Resource resources.robot
*** Test Cases ***
Selenium Demo
Open Login Page
*** Settings ***
Library SeleniumLibrary
*** Keywords ***
Open Login Page
Open Browser https://robotframework.org/demoapp Chrome
|