gpt4 book ai didi

java - 编译 Maven Selenium 项目时出错 - 找不到编译错误包

转载 作者:搜寻专家 更新时间:2023-11-01 03:49:44 26 4
gpt4 key购买 nike

我尝试运行Selenium测试的maven项目(maven -install)

下面是pom

<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>deprecated</groupId>
<artifactId>deprecated</artifactId>
<version>0.0.1-SNAPSHOT</version>

<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.46.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>2.46.0</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.9.4</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>

<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.14.1</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
</archive>
<forkMode>never</forkMode>
<suiteXmlFiles>
<suiteXmlFile>testsuite/TestSuiteBukalapak.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>

</project>

编译错误提示包 org.openqa.selenium 不存在,包 org.testng 不存在,包 org.testng.annotations 不存在和其他好像 maven 构建缺少一些东西。

[INFO] Compiling 43 source files to D:\deprecated\selenium_testng\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /D:/deprecated/selenium_testng/src/deprecated/Tambah_Alamat.java:[3,27] package org.openqa.selenium does not exist
[ERROR] /D:/deprecated/selenium_testng/src/deprecated/Tambah_Alamat.java:[4,27] package org.openqa.selenium does not exist
[ERROR] /D:/deprecated/selenium_testng/src/deprecated/Tambah_Alamat.java:[5,35] package org.openqa.selenium.support does not exist
[ERROR] /D:/deprecated/selenium_testng/src/deprecated/Tambah_Alamat.java:[6,18] package org.testng does not exist
[ERROR] /D:/deprecated/selenium_testng/src/deprecated/Tambah_Alamat.java:[7,30] package org.testng.annotations does not exist
[ERROR] /D:/deprecated/selenium_testng/src/deprecated/core/Settings.java:[5,27] package org.openqa.selenium does not exist
[ERROR] /D:/deprecated/selenium_testng/src/deprecated/core/Settings.java:[6,34] package org.openqa.selenium.chrome does not exist
[ERROR] /D:/deprecated/selenium_testng/src/deprecated/core/Settings.java:[7,34] package org.openqa.selenium.chrome does not exist
[ERROR] /D:/deprecated/selenium_testng/src/deprecated/core/Settings.java:[8,34] package org.openqa.selenium.chrome does not exist
[ERROR] /D:/deprecated/selenium_testng/src/deprecated/core/Settings.java:[9,35] package org.openqa.selenium.firefox does not exist
[ERROR] /D:/deprecated/selenium_testng/src/deprecated/core/Settings.java:[10,35] package org.openqa.selenium.firefox does not exist
[ERROR] /D:/deprecated/selenium_testng/src/deprecated/core/Settings.java:[11,42] package org.openqa.selenium.support.events does not exist
[ERROR] /D:/deprecated/selenium_testng/src/deprecated/core/Settings.java:[12,18] package org.testng does not exist

你能给我一个线索吗,我需要在 pom 上插入任何特定的依赖项吗?谢谢

最佳答案

尝试添加

    <dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-chrome-driver</artifactId>
<version>${selenium.version}</version>
</dependency>

关于java - 编译 Maven Selenium 项目时出错 - 找不到编译错误包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31715148/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com