1. <i id='63RY0'><tr id='63RY0'><dt id='63RY0'><q id='63RY0'><span id='63RY0'><b id='63RY0'><form id='63RY0'><ins id='63RY0'></ins><ul id='63RY0'></ul><sub id='63RY0'></sub></form><legend id='63RY0'></legend><bdo id='63RY0'><pre id='63RY0'><center id='63RY0'></center></pre></bdo></b><th id='63RY0'></th></span></q></dt></tr></i><div id='63RY0'><tfoot id='63RY0'></tfoot><dl id='63RY0'><fieldset id='63RY0'></fieldset></dl></div>
    <legend id='63RY0'><style id='63RY0'><dir id='63RY0'><q id='63RY0'></q></dir></style></legend>

  2. <tfoot id='63RY0'></tfoot>

    <small id='63RY0'></small><noframes id='63RY0'>

        <bdo id='63RY0'></bdo><ul id='63RY0'></ul>

    1. 如何使用 Maven 使用 Selenium 3.4.0 启动 FireFoxDriver?

      How to start FireFoxDriver using Selenium 3.4.0 using Maven?(如何使用 Maven 使用 Selenium 3.4.0 启动 FireFoxDriver?)
      • <small id='uoZFv'></small><noframes id='uoZFv'>

          <bdo id='uoZFv'></bdo><ul id='uoZFv'></ul>

          • <legend id='uoZFv'><style id='uoZFv'><dir id='uoZFv'><q id='uoZFv'></q></dir></style></legend>
            <i id='uoZFv'><tr id='uoZFv'><dt id='uoZFv'><q id='uoZFv'><span id='uoZFv'><b id='uoZFv'><form id='uoZFv'><ins id='uoZFv'></ins><ul id='uoZFv'></ul><sub id='uoZFv'></sub></form><legend id='uoZFv'></legend><bdo id='uoZFv'><pre id='uoZFv'><center id='uoZFv'></center></pre></bdo></b><th id='uoZFv'></th></span></q></dt></tr></i><div id='uoZFv'><tfoot id='uoZFv'></tfoot><dl id='uoZFv'><fieldset id='uoZFv'></fieldset></dl></div>
            <tfoot id='uoZFv'></tfoot>
              <tbody id='uoZFv'></tbody>

              1. 本文介绍了如何使用 Maven 使用 Selenium 3.4.0 启动 FireFoxDriver?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我正在尝试在 maven 项目中使用 Selenium 的最新版本 3.4.0.我使用以下依赖项导入了所有 Selenium 的罐子:-

                I am trying to use Selenium's latest version 3.4.0 in a maven project. I imported all Selenium's jars using below dependency:-

                <dependency>
                    <groupId>org.seleniumhq.selenium</groupId>
                    <artifactId>selenium-java</artifactId>
                    <version>3.4.0</version>
                </dependency>
                

                问题是我无法在 Eclipse 的项目中解决 main 方法中以下代码的任何依赖关系:-

                The problem is I am unable to resolve any dependency in my project in Eclipse for below code inside main method:-

                public class FirefoxTest {
                
                    public static void main(String[] args) {
                        FirefoxOptions options = new FirefoxOptions();
                        options.setBinary("C:\Program Files (x86)\Mozilla Firefox\firefox.exe"); //This is the location where you have installed Firefox on your machine
                
                        FirefoxDriver driver = new FirefoxDriver(options);
                        driver.get("http://www.google.com");
                    }
                }
                

                我错过了什么?Eclipse 无法将 FirefoxDriver 类型解析为任何依赖项.请帮忙.

                What am I missing? Eclipse is unable to resolve FirefoxDriver type to any dependencies. Please help.

                推荐答案

                使用 Selenium 3.4.0 &Mozilla Firefox 53.x 您需要从这里下载最新的 geckodriver v0.16.1.将其保存在您的机器中在代码中提供 geckodriver 的绝对路径.

                To work with Selenium 3.4.0 & Mozilla Firefox 53.x you need to download the latest geckodriver v0.16.1 from here. Save it in your machine & provide absolute path of the geckodriver in your code.

                确保您已使用所需的依赖项更新了 pom.xml,如下所示:

                Ensure that you have updated the pom.xml with the required dependency as follows:

                <dependency>
                        <groupId>org.seleniumhq.selenium</groupId>
                        <artifactId>selenium-java</artifactId>
                        <version>3.4.0</version>
                </dependency> 
                

                建议使用WebDriver接口而不是使用FirefoxDriver实现.

                It is recommended to use the WebDriver interface rather than to use the FirefoxDriver implementation.

                您的代码将如下所示:

                System.setProperty("webdriver.gecko.driver", "C:\Utility\BrowserDrivers\geckodriver.exe");
                WebDriver driver = new FirefoxDriver();       
                driver.navigate().to("http://www.google.com");
                

                提供以下命令来刷掉之前的依赖,安装新的依赖 &执行你的测试:

                Provide the following commands to flush out the previous dependencies, install the new dependencies & execute your test:

                >mvn clean
                >mvn install
                >mvn test 
                

                这篇关于如何使用 Maven 使用 Selenium 3.4.0 启动 FireFoxDriver?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                How to send data to COM PORT using JAVA?(如何使用 JAVA 向 COM PORT 发送数据?)
                How to make a report page direction to change to quot;rtlquot;?(如何使报表页面方向更改为“rtl?)
                Use cyrillic .properties file in eclipse project(在 Eclipse 项目中使用西里尔文 .properties 文件)
                Is there any way to detect an RTL language in Java?(有没有办法在 Java 中检测 RTL 语言?)
                How to load resource bundle messages from DB in Java?(如何在 Java 中从 DB 加载资源包消息?)
                How do I change the default locale settings in Java to make them consistent?(如何更改 Java 中的默认语言环境设置以使其保持一致?)

                        <bdo id='pIidQ'></bdo><ul id='pIidQ'></ul>

                      • <small id='pIidQ'></small><noframes id='pIidQ'>

                        <tfoot id='pIidQ'></tfoot>
                          <legend id='pIidQ'><style id='pIidQ'><dir id='pIidQ'><q id='pIidQ'></q></dir></style></legend>
                            <tbody id='pIidQ'></tbody>
                        1. <i id='pIidQ'><tr id='pIidQ'><dt id='pIidQ'><q id='pIidQ'><span id='pIidQ'><b id='pIidQ'><form id='pIidQ'><ins id='pIidQ'></ins><ul id='pIidQ'></ul><sub id='pIidQ'></sub></form><legend id='pIidQ'></legend><bdo id='pIidQ'><pre id='pIidQ'><center id='pIidQ'></center></pre></bdo></b><th id='pIidQ'></th></span></q></dt></tr></i><div id='pIidQ'><tfoot id='pIidQ'></tfoot><dl id='pIidQ'><fieldset id='pIidQ'></fieldset></dl></div>