简体   繁体   English

找不到Selenium Webdriver和Firefox Server错误

[英]Selenium Webdriver and Firefox Server Not Found error

I'm using Win 7 64, Selenium IDE 2.5.0, WebDriver 2.42 and Eclipse Kepler SR2. 我正在使用Win 7 64,Selenium IDE 2.5.0,WebDriver 2.42和Eclipse Kepler SR2。 I'm trying to launch the browser using driver.get but no matter what URL I put, I get the browser opening but with Server Not Found error. 我正在尝试使用driver.get启动浏览器,但是无论我输入什么URL,我都会打开浏览器,但出现“找不到服务器”错误。 It is driving me crazy. 这让我发疯。 It looks like it opens an instance of Firefox that doesn't look like the one I use to navigate Internet, it doesn't have my bookmarks and my addons and doesn't connect to Internet. 似乎它打开了Firefox的一个实例,该实例看起来不像我用来浏览Internet的Firefox,它没有我的书签和附件,也没有连接到Internet。 Any help? 有什么帮助吗? Thanks. 谢谢。

This is the code that I'm using: 这是我正在使用的代码:

package com.packt.webdriver.chapter1;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa
public class NavigateToAUrl {
    public static void main (String[] args) {
        WebDriver driver = new FirefoxDriver () ;
        driver.get("https://www.google.com");
    }

}

Try with the below code: 尝试以下代码:

System.setProperty("webdriver.firefox.profile", "default");
FirefoxDriver driver = new FirefoxDriver();
driver.get("http://google.com/");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM