Selenium:测试元素是否包含一些文本 [英] Selenium: test if element contains some text

查看:576
本文介绍了Selenium:测试元素是否包含一些文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Selenium IDE,我如何测试元素的内部文本是否包含特定的字符串?例如:

 < p id =fred> abcde< / p> 
'id = fred'containsbcd= true)


解决方案 div>

在这种情况下, Selenium-IDE文档很有用。



您正在查找的命令是 assertText ,定位器将是 id = fred 和文本例如 * bcd *


With Selenium IDE, how can I test if an element's inner text contains a specific string? For example:

<p id="fred">abcde</p>
'id=fred' contains "bcd" = true)

解决方案

The Selenium-IDE documentation is helpful in this situation.

The command you are looking for is assertText, the locator would be id=fred and the text for example *bcd*.

这篇关于Selenium:测试元素是否包含一些文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆