3. ▪ Steering Committee Member, Agile and DevOps Coach at Agile
Testing Alliance and DevOps++ Alliance
▪ Licensed Trainer Agile Testing – ATA (CPSAT (Selenium Automation
Testing), CPDOF (DevOps), CPCCT (Cucumber Driven Continuous
Testing), CPMAT (Master Agile Testing)),Qualified Project
Management Professional (QPMP), CSM, SAFE SDP, Six Sigma Black
Belt, ISTQB certified foundation and advanced level Tester, Sun
Certified Java Programmer, Presenter in International conferences on
Project Management, Agile, DevOps, Quality and Testing
▪ Co-Author of a book on Selenium
▪ 24+ years of IT Industry experience with:
▪ Agile Testing Alliance , Larsen & Toubro Infotech Ltd, India, NSE.IT (National Stock Exchange, India)
▪ Celox Networks, USA, Netscout Systems, USA
▪ BE CSE, MBA Finance from UMASS Lowell.
Aditya Garg
Enterprise Agile and DevOps Coach, DevOps trainer and consultant
5. It is accepted globally
for more than 5 years
now
One of the oldest and
best certification
program in Selenium
#1 Global Certification Program in Selenium
6. Accepted by major IT
organizations and MNC’s
Driven by Agile Testing
Alliance – a global body
present across 24
countries
#1 Global Certification Program in Selenium
7. Only program to have
practical assessment
Two Assessments
1. Theory (60 mins MCQ)
2. Practical (150 mins)
#1 Global Certification Program in Selenium
8. Only program which is
technology agnostic.
Assessment can be taken
up in any of the below tech.
1. Java
2. Python
3. C#
#1 Global Certification Program in Selenium
10. What is a Web Table
https://www.w3schools.com/html/html_tables.asp
11. //*[@id="customers"]/tbody/tr
Handling a static web table with fixed numbers of
rows on display is simple
In the previous example below will give us all the Rows
Using for loop we can browse through the rows and get the
columns in that row
//*[@id="customers"]/tbody/tr[i]/td
For loop has to run from ? (initial and last value?)
Very important as the i is dependent on the correct loop
values.
If we get a list of WebElements = what will be the size
in this example
https://www.w3schools.com/html/html_tables.asp
Demo
14. //*[@id="example"]/tbody/tr Gives us all the rows displayed
//*[@id="example"]/tbody/tr[1] Gives us the first row
//*[@id="example"]/tbody/tr[10] Gives us the last row
We want to capture all the rows in this table. It
has 57 rows
15. If we can
click on
these. Wait
for the table
to populate
then the
problem is
simple. We
have to then
handle
tables on
each click
16. //*[@id="example_paginate"]/span/a
Gives us a list of all the buttons at the
bottom. We can click one by one and then
browse through the table
Please note that the first one is already
clicked. We do not want to click the first
one.
We start from second
17. @Test
public void f() {
// get all the pagination elements
By paginationSpan =
By.xpath("//*[@id="example_paginate"]/span/a");
List <WebElement> pages = driver.findElements(paginationSpan);
// process the first table
// click and process from the second table onwards
// index starts from 0 - we are doing 1 as we want the second
//
for (int i = 1; i < pages.size(); i++) {
WebElement eachTablePage = pages.get(i);
eachTablePage.click();
// process the new table
}
Would this work ?
FAILED: f
org.openqa.se
lenium.StaleE
lementReferen
ceException:
stale element
reference:
element is
not attached
to the page
document
(Session
info:
chrome=85.0.4
183.102)
19. // method to process the table
public void processTable() {
String rowXpath = "//*[@id='example']/tbody/tr";
By locatorRow = By.xpath(rowXpath);
List <WebElement> allRowsList = driver.findElements(locatorRow);
int listsize = allRowsList.size();
// go through each row and get all the columns
// construct a xpath for each row
// //*[@id='example']/tbody/tr[i]/td
// List index is from 0.
// table row index is from 1
// we want from the 1 to 10 row onwards
for (int i = 1 ; i <= listsize; i++) {
String column = "//*[@id='example']/tbody/tr["+i+"]/td";
//System.out.println("Getting columns for the xpath = " + column);
By columnXpath = By.xpath(column);
List <WebElement> allColumns = driver.findElements(columnXpath);
// browse through all the columns and print them on the console
System.out.print("Row " + i + " = ");
for (int j = 0; j<allColumns.size() ; j++ ) {
WebElement columnElement = allColumns.get(j);
System.out.print(columnElement.getText()+"::");
}
// print new line.
System.out.println();
}
}
ProcessTable
method is same
as our static web
table. We
process the rows
and columns
similarly
21. Only program to have
practical assessment
Two Assessments
1. Theory (60 mins MCQ)
2. Practical (150 mins)
#1 Global Certification Program in Selenium