6
5

More than 5 years have passed since last update.

Selenium IDE でテストを実行中の URL を取得する

Posted at

Selenium IDE では storeEval で Javascript の実行結果を変数に保存できることを知り、下記の方法で URL を取得しようとしました。

コマンド 対象
open https://qiita.com/
storeEval document.location url
echo ${url}

ですが下記の実行結果のとおり、変数 url に入っているのは欲しい URL ではありません。

[info] echo: chrome://selenium-ide/content/selenium-ide.xul 

テストを実行中の URL を取得するには下記のようにする必要があります。

コマンド 対象
open https://qiita.com/
storeEval this.page().getCurrentWindow().document.location url
echo ${url}

実行結果です。

[info] echo: https://qiita.com/

下記を参考にしました。ありがとうございます。
http://colo-ri.jp/develop/2008/04/seleniumjavascript.html

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