Selenium Interview Questions Part-2

Selenium Interview questions mostly asked in MNC’s Part-2

1.What is WebDriver ?
i.WebDriver is API which controls browser interaction in Selenium Suite
ii.WebDriver technically is Interface in WebDriver API

2.What  is TestNG and it’s advantage over Junit ?
WebDriver does not have mechanism for generating reports & TestNG gives this mechanism to webdriver.
TestNG Benefits as Below:
        1.Annotations are easier to understand as compared to Junit
        2.Test cases can be grouped more easily in TestNG
        3.Parallel Testing is Possible in TestNG

3.Why to use Thread.sleep ,Implicit or Explicit wait ?
To solve synchronization problem. During Automation Testing two software are working i.e.  Selenium and ClearTrip (AUT-Application under Test ) & there are time AUT needs to communicate with database or do API Calls which required little long time but Selenium is firing all commands with same speed .Hence there is changes of script  failure due to availability of elements or Obejects.

4.Why Assertion are Important in Selenium?
Assertions are point where comparison between expected and actual happens. & without it just browser interaction happens with no testing.

5.What is Maven ? & in which folder maven dependencies are stored ?
A kind of build tool to combine all source code into single unit & maven repository is also there for downloading and attaching Jars to project. .m2 is folder where all jars downloaded and stored.

6.Why to use JavaScriptExecuter  ?
For Scrolling on Web Page.

7.Difference between driver.close() & driver.quit().
For closing focused tab driver.close() is used & for closing browser(and all associated tabs ) driver.quite() is used.

8.Difference between findElement & findElements().
findElement:
1.Used for working with single element on web page.
2.Return type is WebElement
3.NoSuchElement exception is thrown if web object is not found

findElements:
1.Used for working with multiple element on web page .
2.Return type is List<WebElement>
3.No exception is thrown if web object is not found(Empty list is returned in case of web object is not found )

9.Difference between Actions and Action.
Actions:
1.It is Class
2.Used for controlling keyboard and mouse movements/actions.

Action:
1.It is Interface
2.Used for making composite(series) of action

10.What is Advantage of Relative Xpath over CSS ?
CSS can travel only in one direction (Parent node to Child node) but Xpath can travel bi-direction(Parent node to Child node & Child node to Parent node)

Comments