无法在45000 ms- selenium webdriver内绑定到锁定端口7054

时间:2013-11-25 07:08:36

标签: java selenium-webdriver localhost

在eclipse中,我试图打开网址。我试图在代码中点击的网址只在我的localhost中,我尝试使用以下代码在firefox中打开:

package com.example.tests;

import java.util.concurrent.TimeUnit;

import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.Select;
import org.testng.annotations.BeforeMethod;

public class SeleniumTest {
private WebDriver driver;
private String baseUrl;
private StringBuffer verificationErrors = new StringBuffer();

@BeforeMethod
@BeforeClass
public void setUp() throws Exception {
driver = new FirefoxDriver();
Thread.sleep(5000);

baseUrl = "https://oai1amth01/selenium/";

}

@Test
public void testSelenium() throws Exception {
driver.get(baseUrl);
/*driver.findElement(By.linkText("form.html")).click();
driver.findElement(By.id("nameId")).clear();
driver.findElement(By.id("nameId")).sendKeys("Test");
new Select(driver.findElement(By.id("ageId"))).selectByVisibleText("20");
new Select(driver.findElement(By.id("placeId"))).selectByVisibleText("Chennai");
driver.findElement(By.id("submitId")).click();*/
}

@AfterMethod
public void tearDown() throws Exception {
driver.quit();
String verificationErrorString = verificationErrors.toString();
if (!"".equals(verificationErrorString)) {
fail(verificationErrorString);
}
}

private void fail(String verificationErrorString) {
// TODO Auto-generated method stub

}
}

运行代码时出现上述错误。任何人都可以帮助解决这个问题

0 个答案:

没有答案