Saturday, October 31, 2015

WebDriver Interview Questions - I


  1. What is Selenium 2.0 ?
    Answer : Selenium 2.0 is the integration of the WebDriver API & Selenium RC. WebDriver is designed to provide a simpler, more concise programming interface in addition to addressing some limitations in the Selenium-RC API.

  2. What are different languages it supports ?
    Answer : Automation scripts can be written using WebDriver in any of the following languages. java, C#, Python, Ruby, Perl, PHP

  3. Is WebDriver class or interface?
    Answer : WebDriver is an interface. WebDriver is the name of the key interface against which tests should be written, but there are several implementations.

  4. What are all different classes implemented WebDriver interface?
    Answer : WebDriver implementations include
    • HtmlUnitDriver
    • FirefoxDriver
    • InternetExplorerDriver
    • ChromeDriver
    • OperaDriver

  5. What is HtmlUnitDriver ?
    Answer : It is the fastest and most lightweight implementation of WebDriver. As the name suggests, this is based on HtmlUnit. HtmlUnit is a java based implementation of a WebBrowser without a GUI.

  6.  Which WebDriver implementation is the fastest ?
    Answer : HtmlUnitDriver. Because it executes the tests without launching the browser (headless)

  7. How to launch firefox browser using WebDriver?
    Answer : Using FirefoxDriver we can launcg firefox browser.
             WebDriver driver = new FirefoxDriver();  // this will launch firefox browser

  8. How will you load URL in browser?
    Answer : We can loan an URL in browser by calling "get" method
                  driver.get("http://www.google.com");

  9. Tell me about different types of element locators?
    Answer : By mechanism used to locate elements within a document.
            By.id("<Element ID>")
            By.name("<Element Name>");
            By.cssSelector("<css selector>");
            By.xpath("<element xpath>");
            By.linkText("<Full content of link text >");
            By.partialLinkText("<Partial content of link text>");

  10. Can we load URL without using "get" method?
    Answer : Yes, we can do using navigate() method.
                   driver.navigate().to("http://www.example.com");




No comments:

Post a Comment

Note: Only a member of this blog may post a comment.