简体   繁体   English

Firefox不是从Eclipse Mars启动的

[英]Firefox isn't launching from Eclipse Mars

I'm trying to lauch firefox browser from eclipse using Selenium WebDriver. 我正在尝试使用Selenium WebDriver从Eclipse中禁用Firefox浏览器。 The console window shows "Launching Firefox" and nothing happens. 控制台窗口显示“启动Firefox”,没有任何反应。 What may be wrong? 有什么问题吗?

   package testSanity;
import com.openqa.selenium.FirefoxDriver;
import com.openqa.selenium.WebDriver;
public class testAdminLogin {
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        WebDriver driver = new FirefoxDriver();
System.setProperty("webdriver.gecko.driver","C:\\Users\\Rakesh\\Desktop\\Java_Selenium\\geckod‌​‌​‌​river.exe");
        driver.sendKeys("Click", 12);
    }
}

I'm Using selenium-java-3.3.1, have installed geckodriver path in PATH variable of Windows and have installed Firebug and Firepath plugins in firefox. 我正在使用selenium-java-3.3.1,已在Windows的PATH变量中安装了geckodriver路径,并已在firefox中安装了Firebug和Firepath插件。 Am i missing anything here? 我在这里想念什么吗?

Lol.. Where are you trying to sendKeys? 大声笑..您在哪里尝试发送密钥? You first need to open a webpage and then Identify element using findElement . 您首先需要打开一个网页,然后使用findElement标识元素。 You're missing following command: 您缺少以下命令:

driver.get("http://www.yourURL.com");

Change order of the lines 更改行的顺序

  1. Geckodriver should be set before driver initialization. 应在驱动程序初始化之前设置Geckodriver。

    System.setProperty("webdriver.gecko.driver","C:\\Users\\Rakesh\\Desktop\\Java_Selenium\\geckod‌​‌​‌​river.exe"); System.setProperty( “webdriver.gecko.driver”, “C:\\用户\\勒凯什\\桌面\\ Java_Selenium \\ geckod river.exe”);

    WebDriver driver = new FirefoxDriver(); WebDriver驱动程序=新的FirefoxDriver();

Let me know if it works for you 请让我知道这对你有没有用

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

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