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
Post a Comment