UrbanPro
true

Learn Selenium from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

Selenium Web Driver commonly used method

Sam
07/04/2018 0 0

Navigation

Loading a web page in a current browser window

  • driver.get("www.google.com")
  • driver.navigate().to("www.google.com")
  • driver.navigate().to("www.google.com")

Move back & forward

  • Driver.Navigate().Back()
  • Driver.Navigate().Forward()

Refresh page

  • Driver.Navigate().Refresh()

Locating web elements

By class

  • Id
    • driver.findElement(By.id(”some_id”));
  • ClassName
    • driver.findElement(By.className(”some_class_name”));
  • LinkText
    • driver.findElement(By.linkText(”Signin”));
  • PartialLinkText
    • driver.findElement(By.partiallinkText(”Sign”));
  • Name
    • driver.findElement(By.name(”password”));
  • TagName

    • driver.findElement(By.tagName(”label”));
  • CssSelector
    • Absolute path
      –driver.findElement(By.cssSelector(”html>body>div>p>input”));
    • Relative path
      –driver.findElement(By.cssSelector(”input”));
    • Classselection
      –driver.findElement(By.cssSelector(”.login”));
  • XPath
    • Absolute path
      –driver.findElement(By.xpath(”html/body/p/input”));
    • Relative path
      –driver.findElement(By.xpath(”//input”));
    • Attribute selection
      –driver.findElement(By.xpath(”//input[@id=’username’]”));

Synchronization

Page Load Timeout

  • driver.manage().timeouts(). pageLoadTimeout(30, TimeUnit.SECONDS);

Explicit Wait

  • WebDriverWaitwait = new WebDriverWait(driver, TIME_OUT); wait.until(ExpectedConditions.method);

Window Handling

Handles

  • String windowHandle= driver.getWindowHandle();                                             Iterator<String> windowIterator=browser.getWindowHandles();
  • SwitchTo : driver.switchTo().window(windowHandle);
0 Dislike
Follow 3

Please Enter a comment

Submit

Other Lessons for You

Why JAVA is Platform Independent?
Java is platform independent language because Java has a JVM {Java Virtual Machine} which converts a java code into a byte code which can run on any OS. That means, JVM is working as a sub-platform to...

Overview on Auto IT and use in selenium webdriver
AutoIt v3 is a freeware BASIC-like scripting languages designed for automating the windows GUI and general scripting. It used a combination of simulated keystrokes, mouse movements and window/control manipulation...
S

How Motivation Affects Learning and Behavior
Motivation directs behavior toward particular goals. Motivation leads to increased effort and energy. Motivation increases the amount of effort and energy that learners expend in activities directly...

Constructor Overloading
public class ConstructorOverloading { public ConstructorOverloading(){ System.out.println("default"); } public ConstructorOverloading(String a){ System.out.println("a"); } public ConstructorOverloading(int...
S

Sarthak C.

0 0
0

How to toggle b/w frames in webdriver
driver.switchTo().frame() method takes one of the three possible arguments: A number - Select a frame by its (zero-based) index. A name or ID - Select a frame by its name or ID. A previously found...
X

Looking for Selenium Classes?

The best tutors for Selenium Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn Selenium with the Best Tutors

The best Tutors for Selenium Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more