国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 學(xué)院 > 開發(fā)設(shè)計(jì) > 正文

selenium使用testNG測(cè)試框架編寫webdriver腳本_05

2019-11-06 09:48:40
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

selenium使用testNG測(cè)試框架編寫webdriver腳本_05

關(guān)鍵字:testNG,maven,selenium版本,Firefox版本

遇到的問題:a.運(yùn)行時(shí)報(bào)The JAR file selenium-2.44.0/jcommander-1.29.jarhas no source attachment錯(cuò)誤->使用maven項(xiàng)目形式

                        b.運(yùn)行時(shí)報(bào)The path to the driver executable must beset by the webdriver.gecko.driver system PRoperty; for more information錯(cuò)誤->selenium與firefox版本不兼容造成的,需要引用selenium2.44.0的包(selenium3.0以下版本)

=============================================

1.eclipse中引入testNG插件

2.新建一個(gè)java項(xiàng)目并轉(zhuǎn)換成maven項(xiàng)目

3.在pom.xml文件中引入以下內(nèi)容

 <dependencies>

    <dependency>

     <groupId>org.seleniumhq.selenium</groupId>

      <artifactId>selenium-java</artifactId>

      <version>2.44.0</version>

    </dependency>

  </dependencies>

4.項(xiàng)目中引入TestNG插件

5.新建testNG類并編輯以下內(nèi)容:

public class demo03 {

  WebDriver driver;

  @Test

  public void f() {

      driver.get("https://www.sogou.com/");

      driver.findElement(By.id("query")).sendKeys("測(cè)試");

      driver.findElement(By.id("stb")).click();

  }

  @BeforeMethod

  public voidbeforeMethod() {

      System.setProperty("webdriver.firefox.bin","D://firefox//firefox.exe");

      driver=newFirefoxDriver();

  }

  @AfterMethod

  public voidafterMethod() {

     driver.quit();

  }

}


發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 淅川县| 耿马| 郴州市| 巫山县| 万宁市| 任丘市| 道孚县| 文安县| 周至县| 虹口区| 安庆市| 阜南县| 新巴尔虎左旗| 清水河县| 柘城县| 清河县| 娱乐| 孝义市| 澄迈县| 犍为县| 哈尔滨市| 葵青区| 灯塔市| 义马市| 长岭县| 社旗县| 博爱县| 辽阳市| 合水县| 应城市| 仁化县| 冕宁县| 平凉市| 茌平县| 博客| 元氏县| 乳山市| 抚远县| 新营市| 旬邑县| 重庆市|