PHPUnit_Extensions_Selenium2TestCase_Element_Accessorのusingメソッドでエレメントを検索する際に利用できる$strategyのリストを以下にまとめる。
情報源はphpunit-bundle/Session.php at master · p/phpunit-bundle · GitHub
検索対象 | $strategy | 対応するelementのbyメソッド |
---|---|---|
クラス名 | class name | byClassName |
CSSセレクタ | css selector | byCssSelector |
id属性 | id | byId |
name属性 | name | byName |
XPath | xpath | byXPath |
リンクの文字列 | link text | byLinkText |
タグ | tag name | byTag |
以下、IDで要素を検索する例。
$elem = $this->elements($this->using("id")->value("lst-ib"));