当前位置:网站首页>Assertion of selenium webdriver
Assertion of selenium webdriver
2022-06-12 14:45:00 【Micro blog】
After the test code is executed , How to judge whether the final result meets the expected value , It involves assertions , stay webdriver, It can be asserted by judging whether the content of an element contains the specified content , For example, a piece of data is added , After adding , Want to verify whether this data exists on the current page , By verifying whether the first item of the first item of the data list is the expected value

The specific code is as follows
// By positioning the element first , Then judge the text contained in the element
WebElement check = driver.findElement(By.xpath("/html/body/div[2]/div/div/div[2]/div[2]/div/div[2]/div/div/div/div[2]/div[2]/div/div/div/div/div/div/div/table/tbody/tr/td[2]"));
System.out.println(" The text is :******"+ check.getText());
Assert.assertTrue(check.getText().equals("API01"));
come from <http://lxw198902165221.blog.163.com/blog/static/25895002220179194104953/>
边栏推荐
- webdriver入门
- [wechat applet] 1 Introduction to wechat applet
- [wechat applet] 4 Introduction to wechat developer tools
- 三维重建系统 | L3增量运动恢复结构(增量SFM)
- win10_ Home Edition cannot use remote desktop, and can be accessed by remote desktop.
- 程序构造和解释之过程抽象
- Use Baidu AIP to obtain the text in the specified area of the screen
- Xshell (I) is missing mfc110u DLL file resolution
- NetCore结合CAP事件总线实现分布式事务——入门(1)
- Webdriver opens in full screen and a prompt "Chrome is under the control of automatic test software" appears in Chrome
猜你喜欢

华为设备配置H虚拟专用网

QT multi thread drawing and real-time refreshing method

Serialization and deserialization mechanism in terms of games

华为设备配置OSPF伪连接

New technology: efficient self-monitoring visual pre training, local occlusion no longer need to worry!

Software package for optimization scientific research field

Two methods of implementing asynchronous calling function with QT

Huawei equipment configuration BGP as number replacement

Data collection

Reverse order of Excel
随机推荐
Common DOS commands
Tu oses le croire? Il m'a fallu deux jours pour développer un système de gestion.
数据的收集
C secret script Chapter 1: data storage (in-depth analysis)
QT to realize the simple use of SQLite database
Huawei equipment configuration BGP as number replacement
recursive learning
【Calendar】1. For globalization 2 But only date can be formatted by SDF 3 Month to -1 4 Week from Sunday is the first day
String concatenation and ternary operators
Soft test (VI) Chrome browser installation selenium IDE
Raspberry pie get temperature and send pictures to email
Array one
Detailed explanation of C language memset
[OCR] aspriseocr C # English, number recognition (not Chinese)
Use Baidu AIP to obtain the text in the specified area of the screen
Autofac浅学(2)
selenium之元素定位
Can you believe it? It took me only two days to develop a management system
Energy chain smart electronics landed on NASDAQ: Bain is the shareholder to become the first share of charging services in China
JUnit exception, a method that asserts that the exception information is not empty