我正在学习使用Java来测试我的应用程序的Selenium Webdriver测试。
我已经对Google Chrome和Firefox实施了测试,但是msedgedriver.exe没有打开边缘浏览器。
我需要一些帮助!
public WebDriver getDriver() {
return driver;
}
@BeforeAll
/*--- INICIALIZAÇÃO DO OGFIN*/
public void abrirOgfin() throws Exception {
String link;
int x=2;
switch(x) {
case 1:
System.setProperty("webdriver.gecko.driver", "C:\\workspace\\conf\\firefox\\geckodriver.exe");
driver = new FirefoxDriver();
//link = "http://sistema.ogfin.com.br/ogfin/Login"; //Servidor
link = "http://192.168.1.46:8888/ogfin/Login"; //Local
break;
case 2:
System.setProperty("webdriver.edge.driver", "C:\\workspace\\conf\\edge\\msedgedriver.exe");
driver = new EdgeDriver();
//link = "http://sistema.ogfin.com.br/ogfin/Login"; //Servidor
link = "http://192.168.1.46:8888/ogfin/Login"; //Local
break;
default:
System.setProperty("webdriver.chrome.driver", "C:\\workspace\\conf\\chromedriver.exe");
driver = new ChromeDriver();
link = "http://sistema.ogfin.com.br/ogfin/Login"; //Servidor
//link = "http://192.168.1.46:8888/ogfin/Login"; //Local
}
driver.manage().window().maximize();
driver.get(link);
}
运行代码时,控制台显示:
Starting MSEdgeDriver 75.0.139.20 (02d0ed4079b152f381df65e7da8a795530021fb1) on port 9579
Only local connections are allowed.
Please protect ports used by the WebDriver and related test frameworks to prevent access by malicious code.