我正在运行一个简单的代码在firefox broswer中打开google.co.uk但是在eclipse中运行代码后,它只会打开浏览器停在那里。请帮忙。这是代码 -
package basic_webdriver;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class Driver_Test {
public static void main(String[] args) {
WebDriver driver=new FirefoxDriver();
driver.get("https://www.google.co.uk/");
System.out.println(driver.getTitle());
}
}
答案 0 :(得分:0)
尝试
driver.Navigate().GoToUrl("https://www.google.co.uk/");
导航功能告诉浏览器在某处导航。 GoToURL函数指示浏览器应导航到特定URL。 URL的字符串作为GoToURL的参数输入。
以上内容应使浏览器导航到特定网址。