Selenium inputs

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
1 sur 11

Recommandé

iOS Keychain by 흰, 민디iOS Keychain by 흰, 민디
iOS Keychain by 흰, 민디MINJICHO20
106 vues33 diapositives
Reactor Design PatternReactor Design Pattern
Reactor Design Patternliminescence
3.6K vues10 diapositives
AWS Java SDK @ scaleAWS Java SDK @ scale
AWS Java SDK @ scaleTomasz Kowalczewski
1.9K vues27 diapositives
NestJSNestJS
NestJSWilson Su
1.3K vues19 diapositives

Contenu connexe

Tendances(15)

Nestjs MasterClass SlidesNestjs MasterClass Slides
Nestjs MasterClass Slides
Nir Kaufman2.7K vues
Martin Anderson - threads v actorsMartin Anderson - threads v actors
Martin Anderson - threads v actors
bloodredsun2.1K vues
Reactotron -  A Debugging AgentReactotron -  A Debugging Agent
Reactotron - A Debugging Agent
Matthieu Vachon633 vues
Deceptive simplicity of async and awaitDeceptive simplicity of async and await
Deceptive simplicity of async and await
Andrei Marukovich2K vues
Servlet11Servlet11
Servlet11
patinijava1.2K vues
Device Simulator with AkkaDevice Simulator with Akka
Device Simulator with Akka
Max Huang525 vues
16 1816 18
16 18
Erick Regalado191 vues
Servlet FilterServlet Filter
Servlet Filter
AshishSingh Bhatia3.1K vues
Fetch data from formFetch data from form
Fetch data from form
Shahriar Malik98 vues

Similaire à Selenium inputs(20)

Different wait methods or commands in SeleniumDifferent wait methods or commands in Selenium
Different wait methods or commands in Selenium
Vinay Kumar Pulabaigari204 vues
WebDriver WaitsWebDriver Waits
WebDriver Waits
Yaroslav Pernerovsky1.9K vues
waits.pdfwaits.pdf
waits.pdf
ssuser0562f13 vues
waits.pdfwaits.pdf
waits.pdf
ssuser0562f14 vues
Servletand sessiontrackingServletand sessiontracking
Servletand sessiontracking
vamsi krishna554 vues
Web driver trainingWeb driver training
Web driver training
Dipesh Bhatewara813 vues
Synchronization in Selenium WebDriverSynchronization in Selenium WebDriver
Synchronization in Selenium WebDriver
SHUBHAM PATIL3.9K vues
Automation TestingAutomation Testing
Automation Testing
RomSoft SRL1.5K vues
jQuery basics for BeginnersjQuery basics for Beginners
jQuery basics for Beginners
Pooja Saxena78 vues
Core data optimizationCore data optimization
Core data optimization
Gagan Vishal Mishra62 vues
Core Data Performance Guide LineCore Data Performance Guide Line
Core Data Performance Guide Line
Gagan Vishal Mishra930 vues
Servlet   session 6Servlet   session 6
Servlet session 6
Anuj Singh Rajput16 vues
Servlet   session 9Servlet   session 9
Servlet session 9
Anuj Singh Rajput18 vues

Plus de KadarkaraiSelvam

Java 2Java 2
Java 2KadarkaraiSelvam
76 vues10 diapositives
Java 1Java 1
Java 1KadarkaraiSelvam
110 vues11 diapositives
Selenium TestNGSelenium TestNG
Selenium TestNGKadarkaraiSelvam
112 vues15 diapositives
Maven and versioningMaven and versioning
Maven and versioningKadarkaraiSelvam
81 vues16 diapositives

Plus de KadarkaraiSelvam(11)

Selenium web driver useful commandsSelenium web driver useful commands
Selenium web driver useful commands
KadarkaraiSelvam74 vues
Java 2Java 2
Java 2
KadarkaraiSelvam76 vues
Java 1Java 1
Java 1
KadarkaraiSelvam110 vues
Java selenium web driverJava selenium web driver
Java selenium web driver
KadarkaraiSelvam52 vues
Selenium TestNGSelenium TestNG
Selenium TestNG
KadarkaraiSelvam112 vues
Maven and versioningMaven and versioning
Maven and versioning
KadarkaraiSelvam81 vues
Java Inheritance and PolymorphismJava Inheritance and Polymorphism
Java Inheritance and Polymorphism
KadarkaraiSelvam65 vues
Java Control StatementsJava Control Statements
Java Control Statements
KadarkaraiSelvam90 vues
Java JVMJava JVM
Java JVM
KadarkaraiSelvam132 vues
Java variables and classesJava variables and classes
Java variables and classes
KadarkaraiSelvam114 vues
Selenium ide 1Selenium ide 1
Selenium ide 1
KadarkaraiSelvam44 vues

Dernier(20)

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