本文介绍了在45000毫秒内无法绑定到锁定端口70 54的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我尝试使用MVN测试命令行运行硒测试时,出现此错误.奇怪的是,我三天前尝试了一下,并成功运行了:
I'm getting this error when I'm trying to run my selenium test using MVN test command line. Curiously, I tried it 3 days ago and it ran successfully:
------------------------------------------------------
T E S T S
-------------------------------------------------------
Running GoogleNavigationTest
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 45.672 sec <<< FAILURE!
Results :
Failed tests: testApp(GoogleNavigationTest): Unable to bind to locking port 70
54 within 45000 ms
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0
这是我的考试:
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.testng.annotations.Test;
public class GoogleNavigationTest {
@Test
public void testApp(){
// The Firefox driver supports javascript
FirefoxProfile firefoxProfile = new FirefoxProfile();
WebDriver driver = new FirefoxDriver();
// Go to the Google Suggest home page
driver.get("http://www.google.com/webhp?complete=1&hl=en");
// Enter the query string "Cheese"
WebElement query = driver.findElement(By.name("q"));
query.sendKeys("Cheese");
// Sleep until the div we want is visible or 5 seconds is over
long end = System.currentTimeMillis() + 5000;
while (System.currentTimeMillis() < end) {
WebElement resultsDiv = driver.findElement(By.className("gssb_e"));
// If results have been returned, the results are displayed in a drop down.
if (resultsDiv.isDisplayed()) {
break;
}
}
// And now list the suggestions
List<WebElement> allSuggestions =
driver.findElements(By.xpath("//td[@class='gssb_a gbqfsf']"));
for (WebElement suggestion : allSuggestions) {
System.out.println(suggestion.getText());
}
}
}
推荐答案
我刚刚使用了chromeDriver,它工作正常.
I just used the chromeDriver and it works fine .
这篇关于在45000毫秒内无法绑定到锁定端口70 54的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!