LoginSignup
11
10

More than 5 years have passed since last update.

Selenium with WebDriverJS

Last updated at Posted at 2014-01-22

セットアップ

Downloads - selenium - Browser automation framework - Google Project Hosting
  • ダウンロードページ
WebDriverJs - selenium - A guide to using the JavaScript bindings for WebDriver. - Browser automation framework - Google Project Hosting
  • オフィシャルマニュアル
  • mochaのサンプルがどうしてもうまく動かない…。

はまりどころ

chromeとieを動かすには、selenium起動時にdriverへのパスを通しておく

java -jar selenium-server-standalone-2.39.0.jar -Dwebdriver.chrome.driver=./chromedriver.exe -Dwebdriver.ie.driver=./IEDriverServer.exe
  • 起動時指定していないと↓なエラーが出る

WARN - Exception: The path to the driver executable must be set by the webdriver.ie.driver system property;

IEは、オプションのセキュリティ設定で「保護モード」を同じにしておく

  • 保護モードが違っていると↓のエラーが出る

WARN - Exception: Unexpected error launching Internet Explorer. Protected Mode settings are not the same for all zones. Enable Protected Mode must be set to the same value (enabled or disabled) for all zones. (WARNING: The server did not provide any stacktrace information)

サンプル

"Web開発ツールを使いこなせ!"クリエイターの道具箱 (12) Selenium WebDriverを使ったテストの自動化 | マイナビニュース
Automated e2e testing- WebDriverJS, Jasmine and Protractor
  • WebDriverJsでブラウザ操作し、jasmine-nodeでテストをかける方法
End-to-End Testing for Web Apps (Meteor / Selenium / WebDriverJS Example) — Xolv.io

WebDriverでのブラウザ操作コーディングテクニック

公式ドキュメントから

  • WebDriverJsのコードはないが、テクニックは大体おなじはず。Javaのコードを脳内変換する。
Selenium WebDriver — Selenium Documentation
Test Design Considerations — Selenium Documentation
  • "Location Strategies", "Wrapping Selenium Calls", "Page Object Design Pattern"は使えそう。

トピック

Selenium WebDriverのwaitを活用しよう│ソフトウェアテストラボ|アプリテスト|スマートフォンテスト|株式会社シフト

Reference

webdriver.WebDriver
  • webdriverのAPIドキュメント。ブラウザ操作にどんなコマンド使えるかはなんとなくわかる。
webdriver.js - selenium - Browser automation framework - Google Project Hosting
  • webdriverのソースコード。
API Docs for WebDriverJS
  • APIドキュメントの目次。自動生成されてるだけっぽくて何が何やら。
11
10
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
11
10