当前位置:网站首页>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/>
边栏推荐
- Installation and use of mat
- Autofac初学(1)
- Serialization and deserialization mechanism in terms of games
- 程序构造和解释之第一章习题
- 华为设备配置OSPF伪连接
- Analysis of two-dimensional array passing as function parameter (C language)
- 三维重建系统 | L3双视角运动恢复结构(SFM双目SFM)
- Sizeof calculation space size summary
- Simple code implementation of addition, subtraction, multiplication and division calculator
- Energy chain smart electronics landed on NASDAQ: Bain is the shareholder to become the first share of charging services in China
猜你喜欢
Tu oses le croire? Il m'a fallu deux jours pour développer un système de gestion.
Two methods of implementing asynchronous calling function with QT
[wechat applet] 3 The first wechat applet
我愿称之为史上最全的深度学习面经总结(附答案详解)
Two methods of QT using threads
Jetpack架构组件学习(3)——Activity Results API使用
[OCR] aspriseocr C # English, number recognition (not Chinese)
Soft test (VI) Chrome browser installation selenium IDE
Huawei equipment configuration BGP as number replacement
Printing colored messages on the console with printf
随机推荐
New technology: efficient self-monitoring visual pre training, local occlusion no longer need to worry!
Yiwei lithium energy plans to raise 9billion yuan: liujincheng and luojinhong jointly subscribe for 6billion yuan of layout Optical Valley
MAT的安装和使用
Common assertions in JUnit testing
C secret arts script Chapter 5 (structure) (Section 1)
QT realize picture dragging
jenkins的RPC测试项目
[gatewaysessioninactiveevent event] 1 Connect your own client disconnect
Sorting out the differences between ABS () and Fabs () in C language
Writing method of JUnit multithreading
Junit多线程的写法
C secret script Chapter 1: data storage (in-depth analysis) supplement
Mobileone: the mobile terminal only needs 1ms of high-performance backbone. You deserve it!
Variable parameters
Copy word content to excel and automatically divide it into multiple columns
JUnit exception, a method that asserts that the exception information is not empty
【OCR】AspriseOCR C# 英文、数字识别(中文不行)
程序构造和解释之过程抽象
G++ error in compiling Win32 program: undefined reference to '__ imp_ GetStockObject‘
Raspberry pie get temperature and send pictures to email