java - How to Disable JavaScript in WebDriver when automating in Selenium? -
i trying write test tests non-js version of website. use selenium java. have tried this:
firefoxprofile profile = new firefoxprofile(); profile.setpreference("javascript.enabled", false); driver = new firefoxdriver(profile); driver.get();
however isn't working. loads page javascript enabled.
as workaround did, this, requirement.
manually set javascript.enabled
property false
following script.
webdriver driver = new firefoxdriver(); driver.get("about:config"); actions act = new actions(driver); act.sendkeys(keys.return).sendkeys("javascript.enabled").perform(); act.sendkeys(keys.tab).sendkeys(keys.return).perform();
Comments
Post a Comment