Monday, August 8, 2016

What are different Implementing Classes available for WebDriver?

If you have experience of around 2 years in automation testing then is one of the most common question you may be asked in interview

Here's the answer :

  • ChromeDriver
  • EdgeDriver
  • OperaDriver
  • FirefoxDriver
  • InternetExplorerDriver
  • SafariDriver
  • RemoteWebDriver
  • EventFiringWebDriver

     In interview you should be able to name 5-6 WebDriver Implementing Classes.         

Tuesday, August 2, 2016

Difference between Webdriver get() and Webdriver navigate()

GET will wait till the whole page gets loaded i.e. the on-load event has fired before returning control to our test or script.

Note : If there many ajax calls in the current page which webdriver is loading, then webdriver may not know when it has loaded completely. That time to make sure pages are fully loaded then you need to use " wait " .

Navigate will just redirect to our required page and will not wait.

get() navigate()
Waits till complete page loads. Will not wait until the page loads, you can feel this experience only if page takes time to load, like more number of images or ajax calls etc......
We can not perform forward, backward & refresh operation in the browser. We can perform forward, backward & refresh operation in the browser


driver.navigate().back(); // Perform backward function of browser
driver.navigate().forward();  // Perform forward function of browser
driver.navigate().refresh(); //refresh the browser

Difference between Absolute (“/”) and Relative (“//”) in Xpath?

Absolute Xpath => Single Slash “/” – Single slash is used to create Xpath with absolute path i.e. the xpath would be created to start selection from the document node/start node.

 Absolute xpath: /html/body/div[2]/div/div/footer/section[3]/div/ul/li[3]/a

Relative Xpath => Double Slash “//” – Double slash is used to create Xpath with relative path i.e. the xpath would be created to start selection from anywhere within the document.

 Relative xpath: //body//section[3]/div/ul/li[3]/a

Absolute xpaths are prone to more regression as slight change in DOM makes them invalid or refer to a wrong element