我在我的网站上运行带有 Java/TestNG 自动用户注册的 Selenium Webdriver。从 CSV 读取
首先,我打开一个具有特定配置文件的 Firefox 然后我有一个循环,在其中我创建一个用户并将其注销,然后再次转到注册页面并注册另一个用户,将其注销等。
一切正常,但我收到这些红色警告,我不知道它们与什么有关:
INFO: I/O exception (java.net.BindException) caught when connecting to the target host:
Address already in use: connect
由于下面的答案,我现在明白了,我可能需要关闭()或断开()一些连接,但是哪些?
这段代码是我曾经做过的:
public void setUp(ArrayList<ArrayList<String>> array) throws Exception {
long timeoutInSeconds = 30;
ProfilesIni profile = new ProfilesIni();
FirefoxProfile ffprofile = profile.getProfile("SELENIUM");
WebDriver driver = new FirefoxDriver(ffprofile);
WebDriverWait wait = new WebDriverWait(driver, timeoutInSeconds );
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
userSignup(array, driver, wait);
这就是我循环的内容:
driver.get("http://asd.asd.com/users/sign_up");
并且还有一个与 CSV 文件阅读器的打开连接,但在方法结束时,在传递了一组数据后,我将其关闭。