Selenium Customise Xpath -


I bring all the elements of the page using driver.findElements (By.xpath ....

In a page we as shown below Xpath is produced randomly:

  // * [@ id = 'ContentPlaceHolder1_dataListSessionTime_lblCinemasName_0'] / span // * [@ id = 'ContentPlaceHolder1_dataListSessionTime_lblCinemasName_1'] / span // * [@ id = 'ContentPlaceHolder1_dataListSessionTime_lblCinemasName_2'] / span   

and so on ..

I like the elements present on a Need to calculate the number of pages

I am trying to use exposed / code as shown below.

* = xpath; Represent the beginning with the character.

  string MovieCinemas = // * [@ id * = 'ContentPlaceHolder1_dataListSessionTime_lblCinemasName_ List & lt; WebElement & gt; Elements = driver.findElements (By.xpath ("")); Println ("number of elements found:" + elements.size ());   

I am unable to calculate the elements. Lso throws an exception, unable to find the element.

You () instead function in XPath: < pre class = "lang- Java prettyprint- override"> string xpath = "// * [starts-with (@ id, 'ContentPlaceHolder1_dataListSessionTime_lblCinemasName_')] / span"; & Lt; WebElement & gt; Element = Driver. Find Elements (Bye xpath); System.out.println ("The number of elements found:" + elements.size ());

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -