phantomjs无法打开网址

时间:2015-03-02 06:09:47

标签: java selenium-webdriver phantomjs

在我的Selenium webdriver测试中,我没有运气让Phantomjs访问网址。断言后,我继续收到以下错误 -

Expected :Login
Actual   :403 - Forbidden: Access is denied.

at org.junit.Assert.assertEquals(Assert.java:115)
at org.junit.Assert.assertEquals(Assert.java:144)
at        

这是我的 - 同样HTML单元驱动程序做同样的事情。但是,当我使用Firefox驱动程序时,运行正常。

public class EasyElectPhantomTest {

private WebDriver driver;
private boolean acceptNextAlert = true;
private StringBuffer verificationErrors = new StringBuffer();
private String baseUrl;

@Before

public void setUp() throws Exception {
driver = new PhantomJSDriver();
baseUrl = "https://secure02.pilot.principal.com/";

@Test
public void testEasyElectPhantom() throws Exception {

driver.get(baseUrl + "/login?token=ODEFIJMLEHGIOPRNGIYN");
driver.manage().window().maximize();  //Maximizing window
driver.manage().timeouts().implicitlyWait(40, TimeUnit.SECONDS);

assertEquals("Login", driver.getTitle());

driver.findElement(By.id("firstName")).sendKeys("Ryan");

0 个答案:

没有答案