SlideShare a Scribd company logo
1 of 11
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

What's hot

Introduction to SQLite in Adobe AIR 1.5
Introduction to SQLite in Adobe AIR 1.5Introduction to SQLite in Adobe AIR 1.5
Introduction to SQLite in Adobe AIR 1.5
Peter Elst
 

What's hot (15)

Entity Component System - for App developers
Entity Component System - for App developersEntity Component System - for App developers
Entity Component System - for App developers
 
Experienced Selenium Interview questions
Experienced Selenium Interview questionsExperienced Selenium Interview questions
Experienced Selenium Interview questions
 
Nestjs MasterClass Slides
Nestjs MasterClass SlidesNestjs MasterClass Slides
Nestjs MasterClass Slides
 
Martin Anderson - threads v actors
Martin Anderson - threads v actorsMartin Anderson - threads v actors
Martin Anderson - threads v actors
 
Reactotron - A Debugging Agent
Reactotron -  A Debugging AgentReactotron -  A Debugging Agent
Reactotron - A Debugging Agent
 
Deceptive simplicity of async and await
Deceptive simplicity of async and awaitDeceptive simplicity of async and await
Deceptive simplicity of async and await
 
Servlet11
Servlet11Servlet11
Servlet11
 
Device Simulator with Akka
Device Simulator with AkkaDevice Simulator with Akka
Device Simulator with Akka
 
16 18
16 1816 18
16 18
 
Introduction to SQLite in Adobe AIR 1.5
Introduction to SQLite in Adobe AIR 1.5Introduction to SQLite in Adobe AIR 1.5
Introduction to SQLite in Adobe AIR 1.5
 
Servlet Filter
Servlet FilterServlet Filter
Servlet Filter
 
End to end todo list app with NestJs - Angular - Redux & Redux Saga
End to end todo list app with NestJs - Angular - Redux & Redux SagaEnd to end todo list app with NestJs - Angular - Redux & Redux Saga
End to end todo list app with NestJs - Angular - Redux & Redux Saga
 
CLS & asyncListener: asynchronous observability for Node.js
CLS & asyncListener: asynchronous observability for Node.jsCLS & asyncListener: asynchronous observability for Node.js
CLS & asyncListener: asynchronous observability for Node.js
 
Fetch data from form
Fetch data from formFetch data from form
Fetch data from form
 
How to instantiate any view controller for free
How to instantiate any view controller for freeHow to instantiate any view controller for free
How to instantiate any view controller for free
 

Similar to Selenium inputs

Servletand sessiontracking
Servletand sessiontrackingServletand sessiontracking
Servletand sessiontracking
vamsi krishna
 

Similar to Selenium inputs (20)

Different wait methods or commands in Selenium
Different wait methods or commands in SeleniumDifferent wait methods or commands in Selenium
Different wait methods or commands in Selenium
 
Implicit and Explicit waits in Selenium WebDriwer, how to.
Implicit and Explicit waits in Selenium WebDriwer, how to.Implicit and Explicit waits in Selenium WebDriwer, how to.
Implicit and Explicit waits in Selenium WebDriwer, how to.
 
Yaroslav Pernerovsky - You are doing it wrong all the time
Yaroslav Pernerovsky - You are doing it wrong all the timeYaroslav Pernerovsky - You are doing it wrong all the time
Yaroslav Pernerovsky - You are doing it wrong all the time
 
Latest Selenium Interview Questions And Answers.pdf
Latest Selenium Interview Questions And Answers.pdfLatest Selenium Interview Questions And Answers.pdf
Latest Selenium Interview Questions And Answers.pdf
 
WebDriver Waits
WebDriver WaitsWebDriver Waits
WebDriver Waits
 
waits.pdf
waits.pdfwaits.pdf
waits.pdf
 
waits.pdf
waits.pdfwaits.pdf
waits.pdf
 
Servletand sessiontracking
Servletand sessiontrackingServletand sessiontracking
Servletand sessiontracking
 
Web driver training
Web driver trainingWeb driver training
Web driver training
 
Java. Explicit and Implicit Wait. Testing Ajax Applications
Java. Explicit and Implicit Wait. Testing Ajax ApplicationsJava. Explicit and Implicit Wait. Testing Ajax Applications
Java. Explicit and Implicit Wait. Testing Ajax Applications
 
Synchronization in Selenium WebDriver
Synchronization in Selenium WebDriverSynchronization in Selenium WebDriver
Synchronization in Selenium WebDriver
 
We Love Performance! How Tic Toc Games Uses ECS in Mobile Puzzle Games
We Love Performance! How Tic Toc Games Uses ECS in Mobile Puzzle GamesWe Love Performance! How Tic Toc Games Uses ECS in Mobile Puzzle Games
We Love Performance! How Tic Toc Games Uses ECS in Mobile Puzzle Games
 
Automation Testing
Automation TestingAutomation Testing
Automation Testing
 
Selenium interview questions and answers
Selenium interview questions and answersSelenium interview questions and answers
Selenium interview questions and answers
 
jQuery basics for Beginners
jQuery basics for BeginnersjQuery basics for Beginners
jQuery basics for Beginners
 
Core data optimization
Core data optimizationCore data optimization
Core data optimization
 
Core Data Performance Guide Line
Core Data Performance Guide LineCore Data Performance Guide Line
Core Data Performance Guide Line
 
Servlet session 6
Servlet   session 6Servlet   session 6
Servlet session 6
 
Intro to testing Javascript with jasmine
Intro to testing Javascript with jasmineIntro to testing Javascript with jasmine
Intro to testing Javascript with jasmine
 
Servlet session 9
Servlet   session 9Servlet   session 9
Servlet session 9
 

More from KadarkaraiSelvam

More from KadarkaraiSelvam (11)

Selenium web driver useful commands
Selenium web driver useful commandsSelenium web driver useful commands
Selenium web driver useful commands
 
Java 2
Java 2Java 2
Java 2
 
Java 1
Java 1Java 1
Java 1
 
Java selenium web driver
Java selenium web driverJava selenium web driver
Java selenium web driver
 
Selenium TestNG
Selenium TestNGSelenium TestNG
Selenium TestNG
 
Maven and versioning
Maven and versioningMaven and versioning
Maven and versioning
 
Java Inheritance and Polymorphism
Java Inheritance and PolymorphismJava Inheritance and Polymorphism
Java Inheritance and Polymorphism
 
Java Control Statements
Java Control StatementsJava Control Statements
Java Control Statements
 
Java JVM
Java JVMJava JVM
Java JVM
 
Java variables and classes
Java variables and classesJava variables and classes
Java variables and classes
 
Selenium ide 1
Selenium ide 1Selenium ide 1
Selenium ide 1
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 

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