7
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

PHPUnit_Extensions_Selenium2TestCase での各種HTML操作

Posted at

リンクをクリック

サンプルHTML

<a href="">link_text</a>

テストケース

$this->byXPath("//a[text() = 'link_text']")->click();

ボタンクリック

サンプルHTML

<input type="button" value="button_text" id="button_id" >

テストケース

$this->byXPath("//input[@value = 'button_text']")->click();
$this->byCssSelector("#button_id")->click();

テキストボックスに入力

サンプルHTML

<input type="text" name="text_name" >

テストケース

$this->byName('text_name')->value($user);

セレクトボックスから選択

サンプルHTML

<select name="select_name">
<option value="option_value1" >option_text1
<option value="option_value2" >option_text2
</select>

テストケース

$this->select($this->byName("select_name"))->selectOptionByValue("option_value2");

ラジオボタンから選択

サンプルHTML

<input type="radio" name="radio_name1" value="radio_value1" >radio_text1
<input type="radio" name="radio_name2" value="radio_value2" >radio_text2

テストケース

$this->byXPath("//input[@value = 'radio_value1']")->click();

フォームのsubmit

サンプルHTML

<form action="#" method="post">
<input type="submit" value="submit_value">
</form>

テストケース

$this->byCssSelector("form")->submit();

TODO

徐々に追加予定
ラップが薄すぎて辛い

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?