سؤال

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")
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top