Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/371.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/eclipse/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 设置SeleniumWebDriver项目_Java_Eclipse_Maven_Selenium - Fatal编程技术网

Java 设置SeleniumWebDriver项目

Java 设置SeleniumWebDriver项目,java,eclipse,maven,selenium,Java,Eclipse,Maven,Selenium,我想通过SeleniumWebDriver项目使用Java(和eclipse)自动化Firefox 我也在按照网站上的指示行事 我已经在c:/Java/Selenium中创建了一个Selenium文件夹 但是,当我尝试执行以下操作时,什么也没有发生(不是Maven安装): 从命令行,将CD放入项目目录,并按如下方式运行maven 接着 mvn清洁安装 下面是我的pom.xml的内容(我不确定应该同样更新哪个版本) 提前感谢你的帮助 <?xml version="1.0" encoding=

我想通过SeleniumWebDriver项目使用Java(和eclipse)自动化Firefox

我也在按照网站上的指示行事

我已经在c:/Java/Selenium中创建了一个Selenium文件夹

但是,当我尝试执行以下操作时,什么也没有发生(不是Maven安装):

从命令行,将CD放入项目目录,并按如下方式运行maven 接着

mvn清洁安装

下面是我的pom.xml的内容(我不确定应该同样更新哪个版本)

提前感谢你的帮助

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <groupId>MySel20Proj</groupId>
        <artifactId>MySel20Proj</artifactId>
        <version>1.0</version>
        <dependencies>
            <dependency>
                <groupId>org.seleniumhq.selenium</groupId>
                <artifactId>selenium-java</artifactId>
                <version>2.42.2</version>
            </dependency>
            <dependency>
                <groupId>com.opera</groupId>
                <artifactId>operadriver</artifactId>
            </dependency>
        </dependencies>
        <dependencyManagement>
            <dependencies>
                <dependency>
                    <groupId>com.opera</groupId>
                    <artifactId>operadriver</artifactId>
                    <version>1.5</version>
                    <exclusions>
                        <exclusion>
                            <groupId>org.seleniumhq.selenium</groupId>
                            <artifactId>selenium-remote-driver</artifactId>
                        </exclusion>
                    </exclusions>
                </dependency>
            </dependencies>
        </dependencyManagement>
</project>

4.0.0
MySel20Proj
MySel20Proj
1
org.seleniumhq.selenium
硒爪哇
2.42.2
com.opera
操作驾驶员
com.opera
操作驾驶员
1.5
org.seleniumhq.selenium
selenium远程驱动程序

我知道这不是你特别要求的。但我认为这是建立selenium项目最简单的方法

它将为你打开一个firefox,你可以做任何你想做的事情。 您只需要selenium库和firefox路径:

public void setUp() throws Exception {
    System.setProperty("webdriver.firefox.bin","C:\\Users\\your_user\\AppData\\Local\\Mozilla Firefox\\Firefox.exe");
    driver = new FirefoxDriver();

}

它不在示例中,而是它的需要。

您从哪个目录运行
mvn clean install
?从我创建的Selelium文件夹。无论如何,我将重点介绍我的第一个选择,即使用纯java库。