Java Selenium, storing updated page source after javascript activation -
i have managed open browser link , activate javascript, allows page display more results. once done trying print new updated page source in console shows original source prior javascript activation. code far shown below.
webdriver driver = new firefoxdriver(); driver.get("www.desiredlink.com"); if (driver instanceof javascriptexecutor) { ((javascriptexecutor)driver).executescript("javascriptfunction();"); system.out.println(driver.getpagesource()); } else { throw new illegalstateexception("no support javascript!"); }
you have attribute "innerhtml" of body instead of pagesource:
string bodyhtml = driver.findelement(by.tagname("body")).getattribute("innerhtml");
Comments
Post a Comment