VerifyText Present

上一篇 / 下一篇  2012-11-16 16:46:46 / 个人分类:selenium

  
今天在录制IDE的时候最后加了一个验证可一直结果是false,然后尝试了几次都不正确。
最后发觉我在页面右键选择VerifyTextPresent之后,他把要验证的值直接默认放在了Target,因此得手动把要验证的值输入到Value才行。
 
Assertion和Verification:
他们都是为了方便捕捉到failures,然而Effectively an “assert” will fail the test and abort the current test case, whereas a “verify” will fail the test and continue to run the test case.
可以再一个assert后面跟多个verify,例如:
CommandTargetValue
open/download/
assertTitleDownloads
verifyText//h2Downloads
assertTable1.2.1Selenium IDE
verifyTable1.2.2June 3, 2008
verifyTable1.2.31.0 beta 2
 
加载完一个页面后先添加一个assert看下这个页面加载的正确不,如果不正确就可以直接退出这个test case,如果pass再执行verify可以判断下当前的文本位置出现是否正确。就算verify为fail此test case仍然可以继续执行。
 
常用的三个verify命令:
verifyTextPresent:验证特定的文本是否存在页面某处。
CommandTargetValue
verifyTextPresentMarketing Analysis
 
verifyElementPresent:测试存在制定的UI元素,而不是他的内容的时候。
One common use is to check for the presence of an image.
CommandTargetValue
verifyElementPresent//div/p/img

 

VerifyText:文本和UI的时候一块测试的时候,verifyTextmust use a locator.
CommandTargetValue
verifyText//table/tr/td/div/pThis is my text and it occurs right after the div inside the table.

TAG:

fisher house 引用 删除 hero_mars   /   2012-11-20 15:14:13
不好意思啊  我不姓冯
每一步都是一份回忆 引用 删除 qjcslg   /   2012-11-20 10:00:37
你是不是我认识的那个fisher?你姓冯吗
 

评分:0

我来说两句

我的栏目

日历

« 2024-05-16  
   1234
567891011
12131415161718
19202122232425
262728293031 

数据统计

  • 访问量: 18949
  • 日志数: 14
  • 建立时间: 2012-11-02
  • 更新时间: 2015-08-20

RSS订阅

Open Toolbar