我使用的是 Mozilla 51.0.1 和 Eclipse Lunar 3.0.1。当我尝试运行我的代码时,我无法在浏览器中获取 URL,它只是打开。
package SessionPack;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class SessionCalss {
public static void main(String arg[])
{
System.out.println("String");
WebDriver driver;
System.setProperty("webdriver.gecko.driver", "C:\\New folder\\geckodriver.exe");
driver=new FirefoxDriver();
driver.get("www.gooogle.com");
}
}
最佳答案
您的请求有两个地方错误:
- 您写了额外的字符“o” -
gooogle
- 您必须在网址地址前添加
https://
-https://www.google.com
修复后此代码将起作用。
关于java - 无法在 selenium webdriver 中获取 mozilla 中的 URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43928149/