tags:

views:

361

answers:

3

browser.getEval function in selenium makes iterateNext return null ..Otherwise in firebug it returns a value(same script)

document.evaluate("//button[text()='Save']",
                  document, 
                  null,
                  XPathResult.ANY_TYPE,
                  null)
        .iterateNext()
        .disabled;

returns true

But

browser.getEval("document.evaluate(\"//button[text()='Save']\", 
                                     document,
                                     null,
                                     XPathResult.ANY_TYPE,
                                     null)
                         .iterateNext()
                         .disabled;");

returns that error as :

"com.thoughtworks.selenium.SeleniumException: ERROR: Threw an exception: res.iterateNext() is null "

+1  A: 

Try replacing document.evaluate with this.browserbot.getUserWindow().document.evaluate

Dave Hunt
That doesnt work!
anil
this.browserbot is undefined
anil
Are you using Selenium IDE or RC? If RC, what client language are you using? Perhaps you could provide a little more sample code.
Dave Hunt
i'm using testng
anil
Selenium Remote Control (RC)java code
anil
A: 
window.document.evaluate()
Nirmal Patel
A: 

Try replacing

document.evaluate

with

selenium.browserbot.getCurrentWindow().document.evaluate

abhishek