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 just simply trying get the h1 tag in www.example.com which says "Example Domain." The code works for http://www.example.com but not for https://www.exmaple.com. How can I fix this problem? Thanks