What function use to simply retrieve an array of all list


Discuss the below:

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());

Solution Preview :

Prepared by a verified Expert
JAVA Programming: What function use to simply retrieve an array of all list
Reference No:- TGS01934270

Now Priced at $25 (50% Discount)

Recommended (98%)

Rated (4.3/5)