java - Executing the page's JavaScript from Selenium WebDriver -


i'm writing automatic test website, , i'm trying run function exists in site.
when open developer tools can see function i'm trying run in page's javascript, when run alert('hello world') code can see in test page.
code is:

webdriver driver = getdriver(); javascriptexecutor js = (javascriptexecutor) driver; string retval = (string) js.executescript("return thefunction()"); 

what doing wrong?

i using gwt, , before use function need reveal function described in this link under creating javascript libraries gwt section

you'll need "publish" function follows:
$wnd.publishedfuncname = @pakage.class::realfuctionname(d);
d stands double input parameter, fuller list of how refer variables can found here after doing can run function if run console, no window.fuction needed.

and also, had change type of retval object, , used tostring function.


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -