Top 20 Selenium Interview Questions for entry level position

How to discover right Candidate for Selenium Automation role

Top 20 Selenium Interview Questions for entry level position

Whether you are a job seeker or a recruiter, this blog will give you the Top 20 Selenium Interview Questions for an entry-level position, which can be asked during the interview process while hiring a candidate for the Selenium Automation role.

 

You can also check out our blog, where we have listed down some key factors, which you can keep in mind while hiring, to discover the right candidate for the Selenium Automation role.

 

Following are the top 20 Selenium Interview Questions for an entry-level position:

  1. Which are the components of the Selenium suite?

  2. Which testing types are supported by Selenium?

  3. Explain some of the limitations of Selenium?

  4. What is an assertion in Selenium and what are the types of assertion?

  5. Tell the difference between Selenium 2.0 and Selenium 3.0?

  6. What are the different types of Web locators?

  7. Mention the types of waits supported by WebDriver?

  8. What are the various types of navigation commands?

  9. What is that major difference between driver.close() and driver.quit()?

  10. Explain the different exceptions in Selenium WebDriver.

  11. What is an exception test in Selenium?

  12. In selenium, what are listeners?

  13. How do you achieve synchronization in WebDriver?

  14. What is the use of JavaScriptExecutor?

  15. How would you scroll down a page using JavaScript in Selenium?

  16. What are the different types of frameworks?

  17. Which files can be used as a data source for different frameworks?

  18. What is Selenese?

  19. How to handle keyboard and mouse actions using Selenium?

  20. What is the difference between getWindowhandles() and getwindowhandle() ?
  1. Which are the components of the Selenium suite?

    Selenium suite components are as follows:
    • Selenium IDE( Integrated

    • Development Environment)

    • Selenium WebDriver

    • Selenium RC ( Remote Control)

    • Selenium Grid

  2. Which testing types are supported by Selenium?

    Selenium supports functional testing and regression testing

  3. Explain some of the limitations of Selenium?

    Some of the limitations of Selenium are:
    • Selenium only works on web-based applications

    • Selenium does not have an inbuilt reporting feature and depends on a third-party framework for reporting.

    • Captcha and barcode cannot be automated in Selenium.

    • Mobile automation cannot be performed in Selenium.

  4. What is an assertion in Selenium and what are the types of assertion?

    Used as a verification point, assertion verifies that the state of the application is the same as what is expected.
    Types of assertions are: “verify”, “assert”, “waitFor”

  5. Tell the difference between Selenium 2.0 and Selenium 3.0?

    Selenium 2.0 is the combination of SeleniumRC(Selenium1) and WebdDriver which is based on Selenium core, whereas in Selenium 3.0 the core is removed. It supports Selenium RC indirectly through back-end Webdriver.

  6. What are the different types of Web locators?

    Locators are addresses that identify a web element uniquely within the webpage. The different types of Web locators are:
    • Locators by ID: find_element_by_id

    • Locators by class name:find_element_by_class_name

    • Locators by name attribute: find_element_by_name

    • Locators by DOM structure or xpath: find_element_by_xpath

    • Locators by link text: find_element_by_link_text

    • Locators by partial link text: find_element_by_partial_link_text

    • Locators by HTML tag name: find_element_by_tag_name

  7. Mention the types of waits supported by WebDriver?

    • Implicit wait: Implicit wait is used to command Selenium to wait for a certain amount of time before throwing a “No such element” exception.
      Syntax: driver.manage().timeouts().implicitlyWait(TimeOut, TimeUnit.SECONDS);

    • Explicit wait: Explicit wait commands Selenium to wait for certain or expected conditions before throwing an “ElementNotVisibleException” exception.
      Syntax: WebDriverWait wait = new WebDriverWait(WebDriver Reference, TimeOut);

    • Fluent wait: Fluent wait is used to define the maximum time for the web driver to wait for a condition, as well as the frequency with which the condition should be checked before throwing an “ElementNotVisibleException” exception.
      Syntax: Wait wait = new FluentWait(WebDriver reference).withTimeout(timeout, SECONDS).pollingEvery(timeout, SECONDS).ignoring(Exception.class);

  8. What are the various types of navigation commands?

    • Navigate to Command: loads a new web page in the existing browser window driver.navigate().to(“https://www.amazon.in/”);

    • Forward Command enables the web browser to click on the forward button in the existing browser window. It neither accepts anything nor returns anything. driver.navigate().forward();

    • Back Command: enables the web browser to click on the back button in the existing browser window. It neither accepts anything nor returns anything. driver.navigate().back();

    • Refresh Command: refreshes/reloads the current web page in the existing browser window. It neither accepts anything nor returns anything. driver.navigate().refresh();

       

  9. What is that major difference between driver.close() and driver.quit()?

    driver.close(), closes the current window that has the focus, whereas driver.quit() closes all the open browser windows and ends the session.

  10. Explain the different exceptions in Selenium WebDriver.

    Some of the different exceptions in Selenium WebDriver ar as follows:
    • ElementNotVisibleException: When WebDriver tries to find an element but the element is not visible within the page

    • NoSuchAttributeException: Thrown while trying to get attribute value but the attribute is not available in DOM.

    • NoAlertPresentException: Thrown when a user tries to handle an alert box but the alert is not present.

    • WebDriverException: Exception is thrown when a code is unable to initialize WebDriver.

    • NoSuchElementException: This exception is thrown while accessing an element which is not available on the page.

  11. What is an exception test in Selenium?

    Exception test is an exception expected to be thrown inside a test class. We can test whether a code throws a desired exception or not by using the @Test annotation and by specifying which exception is expected by mentioning it in the parameters.

  12. In selenium, what are listeners?

    In Selenium WebDriver, listeners “listen” to the event defined in the selenium script and behave accordingly, thus allowing customization of TestNG reports or logs.

  13. How do you achieve synchronization in WebDriver?

    Synchronization is a mechanism which involves more than one components to work parallel with Each other.It is classified under two categories:
    • Unconditional: In this we specify timeout value only and make the tool wait until certain amount of time , then proceed further.

    • Conditional: We specify a condition along with timeout value, so that tool waits to check for the condition and then come out in case nothing happens.

  14. What is the use of JavaScriptExecutor?

    JavaScriptExecutor provides a mechanism to execute Javascript through the Selenium WebDriver.Two methods which it provides are “executescript” and “executeAsyncScript” methods, to run JavaScript in the context of the currently selected frame.

  15. How would you scroll down a page using JavaScript in Selenium?

    We can scroll down a page by using window.scrollBy() function. e.g. ((JavascriptExecutor) driver).executeScript(“window.scrollBy(0,500)”);

  16. What are the different types of frameworks?

    Different types of frameworks are:
    • Data-Driven Test Framework

    • Keyword Driven Test Framework

    • Hybrid Test Framework

  17. Which files can be used as a data source for different frameworks?

    excel, xml, text, csv

  18. What is Selenese?

    Set of selenium commands, used to test web application is called Selenese. Tester can test the broken links, existence of some object on the UI, Ajax functionality, Alerts, window & list options using Selenese. Selenese commands are:
    • Actions: Used for performing operations

    • Assertions: Used as checkpoints

    • Accessors: Used for storing a value in a particular variable

  19. How to handle keyboard and mouse actions using Selenium?

    In Selenium,keyboard and mouse actions can be handles by using Advanced User Interactions API. The Advanced User Interactions API contains the Actions and the Action Classes that are needed for executing these events. Some of the commonly used keyboard and mouse events provided by the Actions class are:
    • clickAndHold() Clicks (without releasing) the current mouse location.

    • dragAndDrop() Performs click-and-hold at the location of the source element, moves.

    • source, target() Moves to the location of the target element, then releases the mouse.

  20. What is the difference between getWindowhandles() and getwindowhandle() ?
    • getwindowhandle(): helps in getting the window handle of the current window where the control is. Return type is string.

    • getwindowhandles(): helps in getting the handles of all the windows opened. Return type is Set.

Conclusion:


Though there are many set of questions which could be added to the above list, we are very sure that these questions would be more than enough to test the Selenium knowledge and skills of the entry level candidate.

If you are looking to hire an experienced candidate, check out our blog where we have listed down Top 20 Selenium Interview Questions for Experienced Testers. Click here.

No Comments

Post a Comment

Comment
Name
Email
Website

Share
Tweet
Share
Pin