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

Selenium WebDriver 3.0, Test NG and JAVA.
Hello, Selenium WebDriver 3.0 with GeckoDriver is the latest upgrade of Selenium. To execute automation test scripts in Mozilla browser we need to install GeckoDriver seperately and the scripts should...

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

Difference between driver.close() and driver.quit () method
close () -By using this command, we can close the current browser or page. quit() - By using this command, we can shut down the web driver instance or destroy the web driver instance(Close all the windows).

Selenium waits
In Selenium web driver, the biggest challenge is to synchronize your script with the Web application under test. To make this synchronization work, we have concept of waits. Although we can use Thread.sleep()...
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