• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
  • 使用 WebDriver, RemoteWebDriver 啟用各瀏覽器(Java)

    發表于:2012-08-24來源:test China作者:娃娃點擊數: 標簽:WebDriver
    使用 selenium 做 automation 的首要步驟便是通過 webdriver 啟動待測瀏覽器,基于當下主流的 browser(IE FF Chrome),小菜在此略微總結一下。 非 Remote 模式(以FF為例)

      使用 selenium 做 automation 的首要步驟便是通過 webdriver 啟動待測瀏覽器,基于當下主流的 browser(IE FF Chrome),小菜在此略微總結一下。

      非 Remote 模式(以FF為例)

      默認路徑下啟動:

      driver = new FirefoxDriver();

      非默認路徑則先指定路徑,然后再調用默認的構造函數:

      System.setProperty("webdriver.firefox.bin",“D:\\firefox10\\firefox.exe”);

      driver = new FirefoxDriver();

      上述指定路徑是通過更改系統屬性的方式,其實還可以通過 FirefoxBinary 這個類,然后調用另外帶路徑參數的構造函數:

      FirefoxBinary firefoxbin = new FirefoxBinary(new File(“D:\\firefox10\\firefox.exe”));

      driver = new FirefoxDriver(firefoxbin, null)

      Remote 模式

      被 remote 機器上需要準備的條件,

      安全區域設置都設置相同的模式(IE-選項-安全-設置四個區域都統一使用/不使用安全保護模式)

      啟用 selenium 的 standalone-sever(java -jar selenium-sever standalone-2.20.jar)

      待測瀏覽器的 zoom 設置成100%(為了使WebElement在測試中能被準確定位)

      好了基本設置完成后看代碼吧 (假設被 remote 機器的ip為 192.168.1.100),以IE為例

      driver = new CustomRemoteWebDriver(new URL("http://" + “192.168.1.100” + ":4444/wd/hub"), DesiredCapabilities.internetExplorer());

      Chrome 的啟用

      chrome 沒有自帶的 driver,需要

    原文轉自:http://www.kjueaiud.com

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>