Function testCountListElements should simply retrieve an array of all list (html tag li) elements on the page and assert that their total count is three. Utilize an XPath expression for retrieving the elements on the page and assertCount() when doing your assertion. XPath expressions starting with a double slash (ie: //) will locate elements regardless of document position.
/**
* Asserts that the count of list elements on the page is equal
* to three utilizing an xpath expression.
*/
public function testCountListElements() {
/**
*My guess, so far. I have only done Java/Junit before.
*$elements = $this->getSession()->element(array('using'=> WebDriver_Container::XPATH, 'value' => '//li*'));
*
*$this->assertCount(3, sizeof($elements));*/
}
If I were doing Java, it would be as below:
List elements = driver.findElements(By.xpath("//li*"));
assertCount(3, elements.size());
It does not matter what the webpage is and we do not net to worry about creating the session or WebDriver (I have that part covered).
I have just never done Php and I am not sure how to handle loading the array via xpath.