【发布时间】:2014-12-09 12:04:15
【问题描述】:
我的默认浏览器是 firefox。但是当我尝试使用 selenium 网络驱动程序加载文件时,它会自动通过谷歌浏览器加载。如何将其更改为 Firefox? Eclipse 首选项也已设置为默认浏览器。
package com.selenium.example;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
public class ExampleSelenium {
public static void main(String[] args) {
FirefoxDriver driver = new FirefoxDriver();
driver.get("http://localhost:3030/fuseki.html");
}}
【问题讨论】:
-
如果你写这个 FirefoxDriver driver = new FirefoxDriver();那么它必须在 Firefox 中打开。
-
@HelpingHands 那没有发生。这就是我的问题。它总是通过谷歌浏览器加载。我在谷歌浏览器中更改了代理设置。因此不支持本地主机。所以我想通过firefox加载localhost。
-
如果你使用其他网址怎么办?而不是本地主机?喜欢 google.com 吗?是在 Firefox 中打开的吗?
-
@HelpingHands 是的。火狐。
-
然后我认为它的本地主机问题..尝试使用方法 driver.Navigate().GoToURL()
标签: java eclipse selenium selenium-webdriver