当前位置:网站首页>Selenium library 4.5.0 keyword explanation (4)
Selenium library 4.5.0 keyword explanation (4)
2022-07-03 23:36:00 【Mark community】
SeleniumLibrary4.5.0 Keyword details ( Four )
Library version :4.5.0
Library scope : overall situation
Named parameters : Supported
brief introduction
SeleniumLibrary yes Robot Framework Of Web Test library .
This document explains how to use SeleniumLibrary Keywords provided . About installation , Support and other information , Please see the python3.9.0 + robotframework + selenium3 Instance experience .
of robotframework More information about the framework , Please see the https://blog.csdn.net/mask5726/category_10537277.html.
SeleniumLibrary Use... Internally Selenium WebDriver Module to control Web browser . About general Selenium For more information , Please see the http://seleniumhq.org.
The content list
1、 Element localization
2、 Browsers and windows
3、 Overtime , Wait and delay
4、 Operation fault function
5、 Boolean parameters
6、webDriver event
7、 Thread support
8、 plug-in unit
9、 introduce
11、 keyword
keyword
SeleniumLibrary4.5.0 There are a total of keywords for 175 individual , Let's look at it one by one :
1 Add Cookie
add to cookie
Parameters :
name
value
path=None
domain=None
secure=None
expiry=None
explain :
take cookie Add to current session .
Name and value are required , route , Domain , Security and expiration are optional . Expiry Support and DateTime Library or era timestamp in the same format .
Example:
Add Cookie foo bar
Add Cookie foo bar domain=example.com
Add Cookie foo bar expiry=2027-09-28 16:21:35 # Expiry As a time stamp .
Add Cookie foo bar expiry=1822137695 # Expiry As a period of seconds .
Be careful :
stay SeleniumLibrary 3.0 Previous version ,expiry Invalid settings .
2 Add Location Strategy
Add positioning strategy
Parameters :
strategy_name
strategy_keyword
persist=False
explain :
Add custom location policy .
Information on how to create and use custom policies , see also “ Custom locator ”. Delete location policy can be used to delete registered policies .
By default , The location policy will be automatically deleted after leaving the current range . take persist Set to true ( See Boolean parameters ) The positioning strategy will remain registered throughout the life cycle of the test .
3 Alert Should Be Present
The alarm should exist
Parameters :
text=
action=ACCEPT
timeout=None
explain :
Verify that there are alerts , And accept the alarm by default .
If there is no alarm , The failure . If the text is a non empty string , Is used to verify the alarm message . Alerts are accepted by default , However, the behavior can be controlled by using the same operation parameters as the operation alarm .
Timeout specifies how long to wait for the alarm to display . If not given , The global default timeout is used .
Be careful :
action and timeout Parameter is SeleniumLibrary 3.0 What's new in . In previous releases , The alarm is always accepted , And the timeout is hard coded to one second .
4 Alert Should Not Be Present
Alarms should not exist
Parameters :
action=ACCEPT
timeout=0
explain :
Verify that no alerts exist .
If the alarm does exist , be action Parameters determine how it should be handled . By default , The alarm was accepted , But it can also be used with “ Handle alarms ” Keyword close or open it in the same way .
Timeout specifies how long to wait for the alarm to display . By default , Don't wait for the alarm at all , But if the alarm may be delayed , You can specify a custom time . Information about grammar , See the time format section .
Be careful :
SeleniumLibrary 3.0 New features in .
5 Assign Id To Element
take id Assign to element
Parameters :
locator
id
explain :
Assign a temporary... To the element specified by the locator ID.
If the locator is complex and / or XPath The expression is slow and requires multiple , This is mainly useful . When reloading the page , The identifier will expire .
For more information about locator Syntax , Please see the “ Positioning elements ” part .
Example :
Assign ID to Element //ul[@class=‘example’ and ./li[contains(., ‘Stuff’)]] my id
Page Should Contain Element my id
. The above example will be a complex xpath The positioned element is used my id To express , So the page contains my id This element .
边栏推荐
- D30:color tunnels (color tunnels, translation)
- Hcip day 16 notes
- The first game of the new year, many bug awards submitted
- Gossip about redis source code 75
- Introduction to the gtid mode of MySQL master-slave replication
- Gossip about redis source code 81
- A treasure open source software, cross platform terminal artifact tabby
- Gossip about redis source code 77
- Esp-idf turns off serial port log output.
- 2022 t elevator repair registration examination and the latest analysis of T elevator repair
猜你喜欢
2022 a special equipment related management (elevator) examination questions and a special equipment related management (elevator) examination contents
2022.02.13
Bufferpool caching mechanism for executing SQL in MySQL
Format cluster and start cluster
How to solve the "safe startup function prevents the operating system from starting" prompt when installing windows10 on parallel desktop?
Pointer concept & character pointer & pointer array yyds dry inventory
Research Report on the scale prediction of China's municipal engineering industry and the prospect of the 14th five year plan 2022-2028
Fluent learning (5) GridView
Amway by head has this project management tool to improve productivity in a straight line
I wrote a chat software with timeout connect function
随机推荐
Gossip about redis source code 73
Recursive least square adjustment
Gorilla/mux framework (RK boot): add tracing Middleware
How to solve the "safe startup function prevents the operating system from starting" prompt when installing windows10 on parallel desktop?
Xiangong intelligent obtained hundreds of millions of yuan of b-round financing to accelerate the process of building non-standard solutions with standardized products
D24:divisor and multiple (divisor and multiple, translation + solution)
Exclusive download! Alibaba cloud native brings 10 + technical experts to bring "new possibilities of cloud native and cloud future"
Make small tip
Scratch uses runner Py run or debug crawler
Op amp related - link
C # basic knowledge (3)
Gossip about redis source code 76
Minimum commission for stock account opening. Stock account opening is free. Is online account opening safe
Ramble 72 of redis source code
Shiftvit uses the precision of swing transformer to outperform the speed of RESNET, and discusses that the success of Vit does not lie in attention!
Research Report on the scale prediction of China's municipal engineering industry and the prospect of the 14th five year plan 2022-2028
Pyqt5 sensitive word detection tool production, operator's Gospel
D29:post Office (post office, translation)
A preliminary study on the middleware of script Downloader
. Net ADO splicing SQL statement with parameters