English 中文(简体)
"VerifyTextPresent" returning incorrect result for Selenium IDE
原标题:

I am using Selenium IDE to record some scenarios and wanted to check if a particular text is present on the page. I inserted a command "VerifyTextPresent". However, it always returns the result as true even when the particular text is not present.

What can be the probable reason? Do I need to modify anything?

最佳回答

Looking at the sourcecode it looks like you are putting the text you are searching for in the incorrect field. verifyTextPresent (and assert...) has only two parameters unlike verifyText which also requires a target.

Unlike verifyText the text element you are searching for should be entered into the second field Target not in Value .

thus the code becomes

<tr>
<td>verifyTextPresent</td>
<td>XYZ</td>
<td></td></tr>

I made the same mistake when learning Selenium as the field names are misleading!

问题回答

Selenium assertions have different modes:

All Selenium Assertions can be used in 3 modes: "assert", "verify", and "waitFor". For example, you can "assertText", "verifyText" and "waitForText". When an "assert" fails, the test is aborted. When a "verify" fails, the test will continue execution, logging the failure.

Try assertTextPresent. This should abort the test immediately.

check that page : http://release.seleniumhq.org/selenium-remote-control/1.0-beta-2/doc/java/com/thoughtworks/selenium/SeleneseTestBase.html#assertTrue%28boolean%29

assert and verify text fields build boolean results with using resource code.





相关问题
Selenium not working with Firefox 3.x on linux

I am using selenium-server , selenium rc for UI testing in my application . My dev box is Windows with FireFox 3.5 and every thing is running fine and cool. But when i try to run selenium tests on my ...

Best browser for testing under Safari Mobile on Linux?

I have an iPhone web app I m producing on a Linux machine. What s the best browser I can use to most closely mimic the feature-limited version of Safari present on the iPhone? (It s a "slimmed down" ...

Code Coverage Tools & Visual Studio 2008 Pro

Just wondering what people are using for code coverage tools when using MS Visual Studio 2008 Pro. We are using the built-in MS test project and unit testing tool (the one that come pre-installed ...

Is there any error checking web app cralwers out there?

Wondering if there was some sort of crawler we could use to test and re-test everything when changes are made to the web app so we know some new change didn t error out any existing pages. Or maybe a ...

热门标签