Selenium Interview Questions

1.What is the difference between Implicit Wait and Explicit Wait ?

Explicit Wait will make the WebDriver wait for a specific web element for the specified time. i.e. Using Explicit Wait, we can make the WebDriver wait for web element 'a' for 5 seconds and another web element 'b' for 10 seconds.

Where as Implicit Wait will make the WebDriver wait for all web elements for the same specified time. Its generally not set for one or two web elements, instead it is once set will be applicable for all elements.  i.e. Unlike Explicit Wait, Implicit Wait once set will be applicable to all the web elements and hence the specified wait time will be applicable for all the web elements.

2. What are the different Classes which implement WebDriver ?

First of all WebDriver is an Interface and there are different classes which implement this Interface in Selenium. The Classes which implement the WebDriver interface in Selenium are FirefoxDriver, ChromeDriver, InternetExplorerDriver, OperaDriver, SafariDriver, RemoteWebDriver, EdgeDriver and EventFiringWebDriver Classes.

Example: In the statement WebDriver driver = new FirefoxDriver(); , WebDriver is an Interface and FirefoxDriver is one of the Classes which is implementing WebDriver Interface.

3. How to read tool tip text using Selenium WebDriver ?

Tool Tip is a text that will be displayed when we hover our mouse cursor over the text or web element on any web page. Selenium WebDriver can read the tool tip text using getAttribute() method. Click here to read how Selenium WebDriver uses getAttribute() method for reading a tool tip from a web page.

4. What are the different WebDriver exceptions, you have faced while working with Selenium Projects ?

Exception is a problem which occurs during the execution of the program and there by stops the program from further execution. Similarly, while running the Selenium programs, different types of Exceptions related to WebDriver may arise. The list of WebDriver related Exceptions that may commonly arise during Selenium programs execution are: NoSuchElementException, ElementNotVisibleException, NoSuchFrameException, NoAlertPresentException, NoSuchWindowException, SessionNotFoundException and StaleElementReferenceException. Click here to find out more on these WebDriver exceptions.

No comments: