0
我嘗試使用谷歌瀏覽器在Eclipse運行硒的webdriver但是當我運行我的代碼,我得到這個錯誤:谷歌瀏覽器與網絡seleneium司機
Starting ChromeDriver 2.25.426923 (0390b88869384d6eb0d5d09729679f934aab9eed) on port 40315
Only local connections are allowed.
這裏是我的代碼:
package Login;
import java.util.regex.Pattern;
import java.util.concurrent.TimeUnit;
import org.junit.*;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
import org.openqa.selenium.*;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.Select;
public class CorrectLogin {
private WebDriver driver;
private String baseUrl;
private boolean acceptNextAlert = true;
private StringBuffer verificationErrors = new StringBuffer();
@Before
public void setUp() throws Exception {
System.setProperty("webdriver.chrome.driver", "D://DownLoads//chromedriver.exe");
WebDriver driver = new ChromeDriver();
baseUrl = "https://10.96.0.65:9443/";
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
@Test
public void testFirstTestCase() throws Exception {
driver.get(baseUrl + "POSAdminTool/AdminTool/Login.faces");
driver.findElement(By.id("form1:passwordLabel")).clear();
driver.findElement(By.id("form1:passwordLabel")).sendKeys("1234");
driver.findElement(By.id("form1:usernameLabel")).clear();
driver.findElement(By.id("form1:usernameLabel")).sendKeys("superuser");
driver.findElement(By.id("form1:btn_login")).click();
assertEquals("Search Account", driver.findElement(By.id("searchTitle")).getText());
}
可能的重複[當與鉻瀏覽器運行webdriver,獲取消息「只有本地連接被允許」,雖然broser啓動正常](http://stackoverflow.com/questions/25080500/when-run-webdriver-with -chrome-browser-getting-message-only-local-connection) –
我試過這個解決方案,但它不起作用 –
這不是錯誤,它是Chrome驅動程序的第一行日誌記錄。之後添加可能包含錯誤的行。這可能是一個版本問題。驗證最新chromedriver.exe – Moshisho