当前位置:网站首页>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 .
边栏推荐
- C # basic knowledge (1)
- Pytorch learning notes 5: model creation
- Hcip day 16 notes
- Pandaoxi's video
- Ningde times and BYD have refuted rumors one after another. Why does someone always want to harm domestic brands?
- Errors taken 1 Position1 argument but 2 were given in Mockingbird
- Hcip day 14 notes
- "Learning notes" recursive & recursive
- Scratch uses runner Py run or debug crawler
- Exclusive download! Alibaba cloud native brings 10 + technical experts to bring "new possibilities of cloud native and cloud future"
猜你喜欢
Pyqt5 sensitive word detection tool production, operator's Gospel
Alibaba cloud container service differentiation SLO hybrid technology practice
Research Report on the scale prediction of China's municipal engineering industry and the prospect of the 14th five year plan 2022-2028
Schematic diagram of crystal oscillator clock and PCB Design Guide
How to make recv have a little temper?
How to solve the "safe startup function prevents the operating system from starting" prompt when installing windows10 on parallel desktop?
Interesting 10 CMD commands
Analysis of refrigeration and air conditioning equipment operation in 2022 and examination question bank of refrigeration and air conditioning equipment operation
Idea set class header comments
QT creator source code learning note 05, how does the menu bar realize plug-in?
随机推荐
D27:mode of sequence (maximum, translation)
Ningde times and BYD have refuted rumors one after another. Why does someone always want to harm domestic brands?
Gossip about redis source code 78
[issue 16] golang's one-year experience in developing Purdue Technology
[note] IPC traditional interprocess communication and binder interprocess communication principle
D30:color tunnels (color tunnels, translation)
ADB related commands
2022 a special equipment related management (elevator) examination questions and a special equipment related management (elevator) examination contents
Make small tip
A preliminary study on the middleware of script Downloader
Idea integrates Microsoft TFs plug-in
Exclusive download! Alibaba cloud native brings 10 + technical experts to bring "new possibilities of cloud native and cloud future"
Minimum commission for stock account opening. Stock account opening is free. Is online account opening safe
Research Report on the scale prediction of China's municipal engineering industry and the prospect of the 14th five year plan 2022-2028
股票开户佣金最低的券商有哪些大家推荐一下,手机上开户安全吗
Gossip about redis source code 80
Common mode interference of EMC
Pandaoxi's video
How to quickly build high availability of service discovery
Generic tips