LoginSignup
7
7

More than 1 year has passed since last update.

Selenium RCでいろいろ

Last updated at Posted at 2015-07-21

Selenium RCでいろんなことをやってみる

「Selenium Remote Control」 が正式名称です。または、「Selenium1.0」です。
※2022年、現在ほぼ使われておりません。。

「Selenium RC」 でちょこっと作成。
「Selenium IDE」 だけでは、Firefox以外のブラウザに対応していないため。
今は 「Selenium WebDriver」 の方が主流かも。しれないですがあえて「Selenium 1.0」で対応することに。

これは何?
ローカルPC上で 「Selenium Server」 サーバーを起動。中継サーバーがJavaScriptのブラウザ操作ロジックをWebページに埋め込み、Webサーバー上へのスクリプトの配置は不要

最新のSeleniumのJarファイルはここです。
http://www.seleniumhq.org/download/

Jarファイル:selenium-server-standalone-3.0.1.jar
起動ブラウザ:firefox

「SeleniumIDE」とは違い、Firefox限定ではなく「Internet Explorer」「Google Chrome」「Safari」「Opera」ブラウザも対象となります。幅広くブラウザテストをするには、おすすめですね。

コマンドラインで指定する
java -jar selenium-server-standalone-3.0.1.jar
Batファイル

firefoxブラウザ
java -jar selenium-server-standalone-3.0.1.jar -htmlSuite "*firefox" "http://www.google.com" "C:\Users\junjun\Downloads\Selenium.html" "C:\Users\junjun\Downloads\test.html"

Chromeブラウザ
java -jar selenium-server-standalone-3.0.1.jar -htmlSuite "*googlechrome" "http://www.google.com" "C:\Users\junjun\Downloads\Selenium.html" "C:\Users\junjun\Downloads\test.html"

Internet Explorerブラウザ
java -jar selenium-server-standalone-3.0.1.jar -htmlSuite "*iexplore" "http://www.google.com" "C:\Users\junjun\Downloads\Selenium.html" "C:\Users\junjun\Downloads\test.html"

htmlSuiteで使用するブラウザ*firefox開くURLhttp://www.google.com」と「使用するスクリプト:C:\Users\junjun\Downloads\Selenium.html」、最後に「テスト結果:C:\Users\junjun\Downloads\test.html」を指定します。

cmd.jpg

SeleniumRCのTestRunnerが起動し、テストがはじまります。

RC.jpg

合わせて、指定した画面も確認。作成したスクリプトが走ります。

yahoo.jpg

テスト結果になります。

result.jpg

スクリプト

今までは、「Firefox」での動作確認でしたが「Internet Explorer」でそのままスクリプトを使用するとエラーが起こってしまいます。しかも、バージョンで動かなくなることが多いので常に調査です。

7
7
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
7
7