Saturday, October 31, 2015

WebDriver Interview Questions - II


  1. What are all classes implementing WebDriver interface?
    Answer : All the following classes implemented WebDriver Interface. ChromeDriver, EdgeDriver, EventFiringWebDriver, FirefoxDriver, HtmlUnitDriver, InternetExplorerDriver, MarionetteDriver, OperaDriver, RemoteWebDriver, SafariDriver.

  2. What are all different methods available in WebDriver?
    Answer : Some of the most important methods available in webDriver are
    • close()
    • findElement(By by)
    • findElements(By by)
    • get(String url)
    • quit()
  3. How will get the title of window?
    Answer : We can get window title using "getTitle()" method with is declared in WebDriver.

  4. What is the return type of "findElement(By by)" method?
    Answer : WebElement. findElement method will return the WebElement found in that page based on specified locator. If no matching elements are found it throws NoSuchElementException

  5. How do you clear content of a text box?
    Answer : Using "clear" method on text box we can clear the content in that.
       Example : driver.findElement(By.id("username")).clear();

  6. What is the submit method in WebElement?
    Answer : If this current element is a form, or an element within a form, then this will be submitted to the remote server. If this causes the current page to change, then this method will block until the new page is loaded.

  7. How will you get the text from below tag?
          <div name='myDiv'>Hello</div>
    Answer : We can get the text of any tag using getText() method on that element. In this case
             String text = driver.findElement(By.name("myDiv")).getText();

  8. How do you refresh the browser?
    Answer : driver.navigate().refresh();

  9. Can we make WebDriver to wait until elements loaded fully?
    Answer : Yes, We can make WebDriver to wait until all the elements/ required elements loaded fully with some timeout condition.

  10. How can I type my text in input box?
    Answer : Using sendKeys method we can type the required text in specified input box
       example : driver.findElement(By.id("coursename")).sendKeys("Selenium-Webdriver");


Related Posts
WebDriver Interview Questions - I



No comments:

Post a Comment

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