LoginSignup
5
3

More than 5 years have passed since last update.

PHPUnit-seleniumでウィンドウを指定する

Last updated at Posted at 2015-04-07

よくWebページではリンク先が新しいウィンドウにいくことがある。
なので、そのページの確認をする際は、新しいウィンドウに移動しなければならない。
が!その方法が分からなかった。

いろいろ調べた結果、
$this->windowHandles()
で、ウィンドウのパラメータ群が取得できることが分かった。
新しいページが立ち上がる毎に記録が増えていく。
なので、

test.php
//ウィンドウパラメータ取得
$windowList = $this->windowHandles();
//一番新しいページに移動
$latestNum = count($windowList) - 1;
$this->window($windowList[$latestNum]);
//一番古いページに移動 
$this->window($windowList[0]);

これでOK。

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