LoginSignup
3
6

More than 5 years have passed since last update.

BrowserStack + browserstack-webdriverで、ブラウザごとのテストを自動化する

Posted at

セットアップ

BrowserStackのアカウントがあれば、すぐに試せるexampleを作りましたので、こちらを参照ください。

テストコード

webdriver = require("browserstack-webdriver")
config = require("./config")

# Input capabilities
capabilities = config.browserstack
capabilities["browser"] = "IE"
capabilities["browser_version"] = "9.0"
capabilities["os"] = "windows"
capabilities["os_version"] = "7"
capabilities["resolution"] = "1024x768"


describe "E2E test examples with \"browserstack-webdriver\"", () ->

  this.timeout(config.mocha.timeout)

  it "Search \"BrowserStack\" by google.", () ->

    driver = new webdriver.Builder().
              usingServer("http://hub.browserstack.com/wd/hub").
              withCapabilities(capabilities).
              build()

    driver.get("http://www.google.com/ncr")
    driver.findElement(webdriver.By.name("q")).sendKeys("BrowserStack")
    driver.findElement(webdriver.By.name("btnG")).click()

    driver.getTitle().then((title) ->
      console.log(title)
    )
    driver.quit()

実行結果サンプル

Windows7 + IE9 にて、
browserstack-node-example.png

参考

3
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
6