美文网首页
selenium项目创建

selenium项目创建

作者: Alse | 来源:发表于2023-03-08 11:24 被阅读0次

    1、创建maven项目,并在pom中引入selenium(版本为selenium3)相关依赖,这里还引入了testng、logger4j依赖,java环境为1.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/maven-v4_0_0.xsd">
      <modelVersion>4.0.0</modelVersion>
      <groupId>org.example</groupId>
      <artifactId>selenium_study</artifactId>
      <version>1.0-SNAPSHOT</version>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <configuration>
                        <source>8</source>
                        <target>8</target>
                    </configuration>
                </plugin>
            </plugins>
        </build>
        <name>Archetype - selenium_study</name>
      <url>http://maven.apache.org</url>
    
      <dependencies>
        <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
        <dependency>
          <groupId>org.seleniumhq.selenium</groupId>
          <artifactId>selenium-java</artifactId>
          <version>3.141.59</version>
        </dependency>
    
          <dependency>
              <groupId>commons-io</groupId>
              <artifactId>commons-io</artifactId>
              <version>2.6</version>
          </dependency>
    
          <!-- https://mvnrepository.com/artifact/org.testng/testng -->
          <dependency>
              <groupId>org.testng</groupId>
              <artifactId>testng</artifactId>
              <version>6.14.3</version>
          </dependency>
    
          <!-- https://mvnrepository.com/artifact/log4j/log4j -->
          <dependency>
              <groupId>log4j</groupId>
              <artifactId>log4j</artifactId>
              <version>1.2.17</version>
          </dependency>
      </dependencies>
    
    </project>
    

    2、下载对应浏览器的 webdriver


    这里使用的是Chromedriver.exe

    相关文章

      网友评论

          本文标题:selenium项目创建

          本文链接:https://www.haomeiwen.com/subject/fkxoldtx.html