php - Select all matching elements in PHPUnit Selenium 2 test case -


it simple select element specifying class, in phpunit selenium 2 test case:

$element = $this->byclassname("my_class"); 

however, if there 2 items of my_class, selector picks 1 of them (probably first one). how can select of them? i'd appreciate allbyclassname:

$elements = $this->allbyclassname("my_class"); foreach($elements $element) {     dosomethingwith($element); } 

is there allbyclassname in phpunit selenium 2 extension?

pavel, can find guidance on how select multiple elements here: https://github.com/sebastianbergmann/phpunit-selenium/blob/b8c6494b977f79098e748343455f129af3fdb292/tests/selenium2testcasetest.php

lines 92-98:

public function testmultipleelementsselection() {     $this->url('html/test_element_selection.html');     $elements = $this->elements($this->using('css selector')->value('div'));     $this->assertequals(4, count($elements));     $this->assertequals('other div', $elements[0]->text()); } 

(this file contains tests selenium2testcase class itself, it's great learning capabilities)

following method, retrieve elements class this:

    $elements = $this->elements($this->using('css selector')->value('*[class="my_class"]')); 

hope helps.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -