SlideShare a Scribd company logo
Selenium WebDriver locate, Wait and
Input
Kadarkarai Selvam
findElement : By
findElements
findElements will return the list of all elements with the same locate value
List<WebElement> elementNames =
driver.findElements(By.className("classname"));
Example
for (int i=0; i<elementNames.size();i++){
System.out.println(elementNames.get(i));}
Handling Waits
❖ Page loading takes time and wait is used to handle that time
❖ Default waiting time is present as Thread.sleep(3000);
❖ If Element is not found, then ElementNotVisibleException exception will be
thrown in the script
❖ Two types of Waits are present
➢ Implicit Wait
➢ Explicit Wait
Implicit Waits
❖ This Wait will tell the web driver to hold on for a certain amount of time before it
throws a “No Such Element Exception”.
driver.manage().timeouts().implicitlyWait(TimeOut,
TimeUnit.SECONDS);
❖ First parameter can be a numeric whole value &
❖ Second parameter can be of SECONDS, MINUTES, MILISECOND, MICROSECONDS,
NANOSECONDS, DAYS, HOURS
Explicit Wait
This wait is based on a certain conditions
WebDriverWait wait = new WebDriverWait(WebDriverRefrence,TimeOut);
E.g.
wait.until(ExpectedConditions.elementToBeClickable(By.id("")));
Explicit Waits : Expected Conditions
1. alertIsPresent()
2. elementSelectionStateToBe()
3. elementToBeClickable()
4. elementToBeSelected()
5. frameToBeAvaliableAndSwitchToIt()
6. invisibilityOfTheElementLocated()
7. invisibilityOfElementWithText()
8. presenceOfAllElementsLocatedBy()
9. presenceOfElementLocated()
10. textToBePresentInElement()
11. textToBePresentInElementLocated()
12. textToBePresentInElementValue()
13. titleIs()
14. titleContains()
15. visibilityOf()
16. visibilityOfAllElements()
17. visibilityOfAllElementsLocatedBy()
18. visibilityOfElementLocated()
Fluency Wait
❖ Fluency wait gives additional control in the script
❖ Wait for a condition, wait frequency with which it can check & Ignore an exception
Wait wait = new FluentWait(WebDriver reference)
.withTimeout(timeout, SECONDS)
.pollingEvery(timeout, SECONDS)
.ignoring(Exception.class);
Example
wait.until(ExpectedConditions.alertIsPresent());
Textbox
driver.findElement(By.id(“”)).click();
driver.findElement(By.id(“”)).sendKeys(“”);
driver.findElement(By.id(“”)).clear(“”);
Select Value
Select thisselect = new
Select(driver.findElement(By.name("dropdown")));
❖ Selects the value from
selectByIndex
selectByValue
selectByVisibleText
Thank you
For any Assistance
kadarkarai@live.com
+91-9578921178

More Related Content

PDF
iOS Keychain by 흰, 민디
PPTX
Reactor Design Pattern
PDF
AWS Java SDK @ scale
PDF
Testing React hooks with the new act function
PDF
Sql Injection Attacks(Part1 4)
PDF
NestJS
RTF
AutoComplete
PDF
Forgive me for i have allocated
iOS Keychain by 흰, 민디
Reactor Design Pattern
AWS Java SDK @ scale
Testing React hooks with the new act function
Sql Injection Attacks(Part1 4)
NestJS
AutoComplete
Forgive me for i have allocated

What's hot (15)

PDF
Entity Component System - for App developers
DOCX
Experienced Selenium Interview questions
PDF
Nestjs MasterClass Slides
PDF
Martin Anderson - threads v actors
PDF
Reactotron - A Debugging Agent
PPTX
Deceptive simplicity of async and await
PPT
Servlet11
PDF
Device Simulator with Akka
PPTX
ZIP
Introduction to SQLite in Adobe AIR 1.5
PDF
Servlet Filter
PDF
End to end todo list app with NestJs - Angular - Redux & Redux Saga
PDF
CLS & asyncListener: asynchronous observability for Node.js
PDF
Fetch data from form
PDF
How to instantiate any view controller for free
Entity Component System - for App developers
Experienced Selenium Interview questions
Nestjs MasterClass Slides
Martin Anderson - threads v actors
Reactotron - A Debugging Agent
Deceptive simplicity of async and await
Servlet11
Device Simulator with Akka
Introduction to SQLite in Adobe AIR 1.5
Servlet Filter
End to end todo list app with NestJs - Angular - Redux & Redux Saga
CLS & asyncListener: asynchronous observability for Node.js
Fetch data from form
How to instantiate any view controller for free
Ad

Similar to Selenium inputs (20)

PPTX
Different wait methods or commands in Selenium
PDF
Yaroslav Pernerovsky - You are doing it wrong all the time
PDF
Implicit and Explicit waits in Selenium WebDriwer, how to.
PDF
How to Use Selenium Waits_ A Step-by-Step Guide.pdf
PDF
Latest Selenium Interview Questions And Answers.pdf
PDF
WebDriver Waits
PDF
waits.pdf
PDF
waits.pdf
PDF
findElement and findElements in Selenium_ Use Cases with Examples.pdf
PPTX
Presentation(Q3).pptxgdfgfgwdfwgdfwgdfwgdfwwwgsvwgdvgdvgdvwg
PDF
Servletand sessiontracking
PPTX
Handling Exceptions and waits in selenium.pptx
PPTX
Web driver training
PPT
Java. Explicit and Implicit Wait. Testing Ajax Applications
PPTX
Synchronization in Selenium WebDriver
PPTX
We Love Performance! How Tic Toc Games Uses ECS in Mobile Puzzle Games
PDF
Automation Testing
PDF
Selenium interview questions and answers
PPTX
jQuery basics for Beginners
PPT
Core data optimization
Different wait methods or commands in Selenium
Yaroslav Pernerovsky - You are doing it wrong all the time
Implicit and Explicit waits in Selenium WebDriwer, how to.
How to Use Selenium Waits_ A Step-by-Step Guide.pdf
Latest Selenium Interview Questions And Answers.pdf
WebDriver Waits
waits.pdf
waits.pdf
findElement and findElements in Selenium_ Use Cases with Examples.pdf
Presentation(Q3).pptxgdfgfgwdfwgdfwgdfwgdfwwwgsvwgdvgdvgdvwg
Servletand sessiontracking
Handling Exceptions and waits in selenium.pptx
Web driver training
Java. Explicit and Implicit Wait. Testing Ajax Applications
Synchronization in Selenium WebDriver
We Love Performance! How Tic Toc Games Uses ECS in Mobile Puzzle Games
Automation Testing
Selenium interview questions and answers
jQuery basics for Beginners
Core data optimization
Ad

More from KadarkaraiSelvam (11)

PPTX
Selenium web driver useful commands
PPTX
PPTX
PPTX
Java selenium web driver
PPTX
Selenium TestNG
PPTX
Maven and versioning
PPTX
Java Inheritance and Polymorphism
PPTX
Java Control Statements
PPTX
PPTX
Java variables and classes
PPTX
Selenium ide 1
Selenium web driver useful commands
Java selenium web driver
Selenium TestNG
Maven and versioning
Java Inheritance and Polymorphism
Java Control Statements
Java variables and classes
Selenium ide 1

Recently uploaded (20)

PDF
Hybrid horned lizard optimization algorithm-aquila optimizer for DC motor
PPTX
Web Crawler for Trend Tracking Gen Z Insights.pptx
PDF
A novel scalable deep ensemble learning framework for big data classification...
PDF
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PDF
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
PDF
Five Habits of High-Impact Board Members
PDF
A contest of sentiment analysis: k-nearest neighbor versus neural network
PPTX
Modernising the Digital Integration Hub
PPTX
Chapter 5: Probability Theory and Statistics
PPT
What is a Computer? Input Devices /output devices
PDF
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
PDF
STKI Israel Market Study 2025 version august
PDF
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
PDF
A Late Bloomer's Guide to GenAI: Ethics, Bias, and Effective Prompting - Boha...
PDF
A review of recent deep learning applications in wood surface defect identifi...
PDF
Hybrid model detection and classification of lung cancer
PDF
Getting started with AI Agents and Multi-Agent Systems
PDF
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
Hybrid horned lizard optimization algorithm-aquila optimizer for DC motor
Web Crawler for Trend Tracking Gen Z Insights.pptx
A novel scalable deep ensemble learning framework for big data classification...
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
Univ-Connecticut-ChatGPT-Presentaion.pdf
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
Five Habits of High-Impact Board Members
A contest of sentiment analysis: k-nearest neighbor versus neural network
Modernising the Digital Integration Hub
Chapter 5: Probability Theory and Statistics
What is a Computer? Input Devices /output devices
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
STKI Israel Market Study 2025 version august
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
A Late Bloomer's Guide to GenAI: Ethics, Bias, and Effective Prompting - Boha...
A review of recent deep learning applications in wood surface defect identifi...
Hybrid model detection and classification of lung cancer
Getting started with AI Agents and Multi-Agent Systems
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...

Selenium inputs

  • 1. Selenium WebDriver locate, Wait and Input Kadarkarai Selvam
  • 3. findElements findElements will return the list of all elements with the same locate value List<WebElement> elementNames = driver.findElements(By.className("classname")); Example for (int i=0; i<elementNames.size();i++){ System.out.println(elementNames.get(i));}
  • 4. Handling Waits ❖ Page loading takes time and wait is used to handle that time ❖ Default waiting time is present as Thread.sleep(3000); ❖ If Element is not found, then ElementNotVisibleException exception will be thrown in the script ❖ Two types of Waits are present ➢ Implicit Wait ➢ Explicit Wait
  • 5. Implicit Waits ❖ This Wait will tell the web driver to hold on for a certain amount of time before it throws a “No Such Element Exception”. driver.manage().timeouts().implicitlyWait(TimeOut, TimeUnit.SECONDS); ❖ First parameter can be a numeric whole value & ❖ Second parameter can be of SECONDS, MINUTES, MILISECOND, MICROSECONDS, NANOSECONDS, DAYS, HOURS
  • 6. Explicit Wait This wait is based on a certain conditions WebDriverWait wait = new WebDriverWait(WebDriverRefrence,TimeOut); E.g. wait.until(ExpectedConditions.elementToBeClickable(By.id("")));
  • 7. Explicit Waits : Expected Conditions 1. alertIsPresent() 2. elementSelectionStateToBe() 3. elementToBeClickable() 4. elementToBeSelected() 5. frameToBeAvaliableAndSwitchToIt() 6. invisibilityOfTheElementLocated() 7. invisibilityOfElementWithText() 8. presenceOfAllElementsLocatedBy() 9. presenceOfElementLocated() 10. textToBePresentInElement() 11. textToBePresentInElementLocated() 12. textToBePresentInElementValue() 13. titleIs() 14. titleContains() 15. visibilityOf() 16. visibilityOfAllElements() 17. visibilityOfAllElementsLocatedBy() 18. visibilityOfElementLocated()
  • 8. Fluency Wait ❖ Fluency wait gives additional control in the script ❖ Wait for a condition, wait frequency with which it can check & Ignore an exception Wait wait = new FluentWait(WebDriver reference) .withTimeout(timeout, SECONDS) .pollingEvery(timeout, SECONDS) .ignoring(Exception.class); Example wait.until(ExpectedConditions.alertIsPresent());
  • 10. Select Value Select thisselect = new Select(driver.findElement(By.name("dropdown"))); ❖ Selects the value from selectByIndex selectByValue selectByVisibleText
  • 11. Thank you For any Assistance kadarkarai@live.com +91-9578921178