当前位置:网站首页>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/>
边栏推荐
- Junit测试中常用的断言
- 我愿称之为史上最全的深度学习面经总结(附答案详解)
- win10_ Home Edition cannot use remote desktop, and can be accessed by remote desktop.
- ADB control installation simulator
- Xshell (I) is missing mfc110u DLL file resolution
- En langage C, la fonction principale appelle une autre fonction et assemble le Code pour comprendre
- QT realize picture dragging
- 面向优化科学研究领域的软件包
- Module yaml error: Unexpected key in data: static_context [line 9 col 3]
- JMeter (V) pressure test of Excel file upload interface
猜你喜欢

亿纬锂能拟募资90亿:刘金成骆锦红夫妇合计认购60亿 布局光谷

安凯微电子冲刺科创板:年营收5亿 小米产业基金是股东

面向优化科学研究领域的软件包

Detailed explanation of C language memset

Copy word content to excel and automatically divide it into multiple columns

webdriver入门

Can you believe it? It took me only two days to develop a management system

阿里建议所有 POJO 类属性使用包装类,但这些坑你有注意到吗?

Leader education was forced to be delisted: Softbank CMC suffered heavy losses only one year after listing

Data collection
随机推荐
Thinking: what is asynchrony and thread safety
【MySQL】数据库基本操作
Unhandled exception stack overflow
Array one
jenkins相关
En langage C, la fonction principale appelle une autre fonction et assemble le Code pour comprendre
selenium-webdriver之断言
C secret arts script Chapter 2 (detailed explanation of pointer) (Section 1)
C secret script Chapter 1: data storage (in-depth analysis) supplement
你敢信?開發一個管理系統我只用了兩天
Ppt cannot be opened, always prompt how to fix it
启明智显分享| 2.8寸手持中控屏应用方案
新技术:高效的自监督视觉预训练,局部遮挡再也不用担心!
Three common methods of C language array initialization ({0}, memset, for loop assignment) and their principles
Two months' experience in C language
Printing colored messages on the console with printf
C secret script Chapter 3 (detailed explanation of string function) (Section 1)
[system. Currenttimemillis()] current timestamp: the number of milliseconds that have elapsed since the current system time was 0:00:00 on January 1, 1970
And, or, not equal, operator
[OCR] aspriseocr C # English, number recognition (not Chinese)