tags:

views:

23

answers:

3

I'm looking to validate a (hidden) tag, which is nothing but some javascript, in a webpage. This tag is present and visible, in the Page Source. I have used selenium's selenium.getHtmlSource(); command before. However, this time around I need assert the presence of absence of the tag, without unnecessarily having to slice and dice the source.

Any ideas? Thanks.

A: 

Consider using jQuery for this. An example like:

if ($("#hidden_tag_id")) {
  ...
}

should do it.

Vasileios Lourdas
A: 

You should be able to assertFalse(isElementPresent("tagid")) from your test.

highlycaffeinated
A: 

I implemented a simple (makeshift) solution:

selenium.open("http://myURL.com");
String pageSource=selenium.getHtmlSource();
int test = pageSource.indexOf("myTag");

I am curious about trying jquery

Rajat