How do I compare the profile link count and popup count in Selenium Webdriver
?
website beta-app.1bridge.in
How do I compare the profile link count and popup count in Selenium Webdriver
?
website beta-app.1bridge.in
For the programming language you are using:
You'll need to use that languages selenium commands such as find_all to load an array (for example) and then you ue the array size
For the popup you may need to use switch window or examine the specific div
Here is a sample I found at http://learnselenium.techcanvass.com/handling-a-web-table-in-selenium-3-0/ The procedure @Michael Durrant summarized above. Instead of printing, you need compare the column values of each row.
Step 1: First get the entire html table and store this in a variable ‘webtable’ of type web element.
WebElement webtable=driver.findElement(By.xpath(“html/body”));
Step 2: Get all the rows with tag name ‘tr’ and store all the elements in a list of web elements. Now all the elements with tag ‘tr’ are stored in ‘rows’ list.
//Finding & Printing number of rows
List<WebElement>rows=webtable.findElements(By.tagName(“tr”));
System.out.println(“Number of Rows including headings:”+ rows.size());
Step 3: Get the number of columns. Here we have used “tagName” of columns – “th”. Please note that this represents the heading row only.
//Finding and printing number of columns
List<WebElement>columns = rows.get(0).findElements(By.tagName(“th”));
System.out.println(“Number of columns:”+ columns.size());
Step 4: Now, we can write the code to access all the rows and columns and its values. Please note that we have used if and else to print header row and other rows.
for(int rnum=1;rnum<=rows.size();rnum++)
{
for (int colnum=1;colnum<=columns.size();colnum++)
{
if (rnum==1)
{
System.out.println(driver.findElement(By.xpath( “.//*[@id=’t01′]/tbody/tr[” + rnum + “]/th[” + colnum + “]”)).getText());
}
else
{
System.out.println(driver.findElement(By.xpath( “.//*[@id=’t01′]/tbody/tr[” + rnum + “]/td[” + colnum + “]”)).getText());
}
}
}