Then you need to do the following
strText = selenium.getText("//h2")
if strText.equals("ABCDEF")
System.out.println("TextMatch")
else
System.out.println("Text Mismatch")
質問
How can I get the text from a simple html tag
<h2>ABCDEF</h2>
using Selenium RC?
I want to match the exact text. If I use isTextPresent()
it returns true even if I put selenium.isTextPresent("ABC")
.
This is in a HTML tag <h2>
.
解決
Then you need to do the following
strText = selenium.getText("//h2")
if strText.equals("ABCDEF")
System.out.println("TextMatch")
else
System.out.println("Text Mismatch")