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

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...

How to write CSS in Selenium web driver
https://www.youtube.com/watch?v=bnErD3x4XlYhttps://www.youtube.com/watch?v=bnErD3x4XlY

Bhanu P.

0 0
0

What is Selenium?
In simple words, Selenium automates browsers. It is a robust set of tools that supports rapid development of test automation for web-based applications. Cool Features: Works on every system,...

Write a script to open firefox without using firefox driver class?
Write a script to open firefox without using firefox driver class? Solution:Runtime.getRuntime().exec("C:\\Program Files\\Mozilla Firefox\\firefox.exe");

How to toggle b/w windows in webdriver
getWindowHandles will provide us handles for all windows available. Set windows = driver.getWindowHandles(); Iterate through all windows and choose suitable window based on its title for (String window...
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