java - PhantomJSDriver works for HTTP but not for HTTPS -
public class footest { webdriver driver; @before public void beforetest() { desiredcapabilities capabilities = new desiredcapabilities(); capabilities.setjavascriptenabled(true); capabilities.setcapability(capabilitytype.accept_ssl_certs, true); driver = new phantomjsdriver(capabilities); driver.manage().timeouts().pageloadtimeout(10, timeunit.seconds); } @test public void test() { driver.get("http://www.example.com"); webelement e = driver.findelement(by.tagname("h1")); system.out.println("text" + e.getattribute("innerhtml")); assertnotnull(e); driver.quit(); } }
hi, i'm trying h1 tag in www.example.com says "example domain." code works http://www.example.com not https://www.exmaple.com. how can prepare problem? thanks
phantomjsdriver not back upwards (all) desiredcapabilities.
you need:
caps = new desiredcapabilities(); caps.setjavascriptenabled(true); caps.setcapability(phantomjsdriverservice.phantomjs_cli_args, new string[] {"--web-security=no", "--ignore-ssl-errors=yes"}); driver = new phantomjsdriver(caps); documented here: https://github.com/detro/ghostdriver/issues/233
java selenium phantomjs
No comments:
Post a Comment