Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using selenium's waitForCondition with an xpath

Selenium has some nice support for finding elements in a page via xpath

selenium.isElementPresent("//textarea")

and in ajax pages you can use waitForCondition to wait on a page until something appears

selenium.waitForCondition("some_javascript_boolean_test_as_a_string", "5000")

My difficulty is, I can't seem to get into a position to use the xpath support for the boolean test. document.getElementById seems to work fine, but selenium.isElementPresent doesn't.

Is there any easy way of accessing selenium's xpath element finding abilities from within waitForCondition's first parameter?

like image 837
Matt Sheppard Avatar asked Jun 16 '09 02:06

Matt Sheppard


1 Answers

An more straightforward way to do it is:

selenium.waitForCondition("selenium.isElementPresent(\"xpath=//*[@id='element_id_here']/ul\");", time_out_here);
like image 126
pearl Avatar answered Nov 08 '22 22:11

pearl