gpt4 book ai didi

java - 无法在 selenium webdriver 中获取 mozilla 中的 URL

转载 作者:行者123 更新时间:2023-12-02 02:50:27 26 4
gpt4 key购买 nike

我使用的是 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");

}
}

最佳答案

您的请求有两个地方错误:

  1. 您写了额外的字符“o” - gooogle
  2. 您必须在网址地址前添加 https:// - https://www.google.com

修复后此代码将起作用。

关于java - 无法在 selenium webdriver 中获取 mozilla 中的 URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43928149/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com