Enroll Now
Classroom Training - 9739216095, Corporate Training - 9590587663

Porto

Top 25 Selenium Interview Question & Answers

Top 25 Selenium Interview Question & Answers

Seleniumlabs, Best Selenium Training in Bangalore shared 25 Interview question & answers.

1. What is Selenium?

Answer:

Selenium is a browser automation tool which lets you automated operations like – type, click, and selection from a drop down of a web page.

 

2. How is Selenium different from commercial browser automation tools?

Answer:

Selenium is a library which is available in a gamut of languages i.e. java, C#, python, ruby, php etc while most commercial tools are limited in their capabilities of being able to use just one language. More over many of those tools have their own proprietary language which is of little use outside the domain of those tools. Most commercial tools focus on record and replay while Selenium emphasis on using Selenium IDE (Selenium record and replay) tool only to get acquainted with Selenium working and then move on to more mature Selenium libraries like Remote control (Selenium 1.0) and Web Driver (Selenium 2.0).

Though most commercial tools have built in capabilities of test reporting, error recovery mechanisms and Selenium does not provide any such features by default. But given the rich set of languages available with Selenium it very easy to emulate such features.

 

3. What are the set of tools available with Selenium?

Answer:

Selenium has four set of tools – Selenium IDE, Selenium 1.0 (Selenium RC), Selenium 2.0 (WebDriver) and Selenium Grid. Selenium Core is another tool but since it is available as part of Selenium IDE as well as Selenium 1.0, it is not used in isolation.

 

4. Which Selenium Tool should I use?

Answer:

It entirely boils down to where you stand today in terms of using Selenium. If you are entirely new to Selenium then you should begin with Selenium IDE to learn Selenium location strategies and then move to Selenium 2 as it is the most stable Selenium library and future of Selenium. Use Selenium Grid when you want to distribute your test across multiple devices. If you are already using Selenium 1.0 than you should begin to migrate your test scripts to Selenium 2.0

 

5. What is Selenium IDE?

Answer:

Selenium IDE is a firefox plug-in which is (by and large) used to record and replay test is firefox browser. Selenium IDE can be used only with firefox browser.

 

6. Which language is used in Selenium IDE?

Answer:

Selenium IDE uses html sort of language called Selenese. Though other languages (java, c#, php etc) cannot be used with Selenium IDE, Selenium IDE lets you convert test in these languages so that they could be used with Selenium 1.0 or Selenium 2.0

 

7. What is Selenium 1.0?

Answer:

Selenium 1.0 or Selenium Remote Control (popularly known as Selenium RC) is library available in wide variety of languages. The primary reason of advent of Selenium RC was incapability of Selenium IDE to execute tests in browser other than Selenium IDE and the programmatical limitations of language Selenese used in Selenium IDE.

 

8. What is Selenium 2.0?

Answer:

Selenium 2.0 also known as WebDriver is the latest offering of Selenium. It provides

  • better API than Selenium 1.0
  • does not suffer from java script security restriction which Selenium 1.0 does
  • supports more UI complicated UI operations like drag and drop

 

9. What are the element locators available with Selenium which could be used to locate elements on web page?

Answer:

There are mainly 4 locators used with Selenium –

  • html id
  • html name
  • XPath locator and
  • Css locators

 

10. What is Selenium Grid?

Answer:

Selenium grid lets you distribute your tests on multiple machines and all of them at the same time. Hence you can execute test on IE on Windows and Safari on Mac machine using the same test script (well, almost always). This greatly helps in reducing the time of test execution and provides quick feedback to stack holders.

 

Selenium IDE Questions

 

11. What are two modes of views in Selenium IDE?

Answer:

Selenium IDE can be opened either in side bar (View > Side bar > Selenium IDE) or as a pop up window (Tools > Selenium IDE). While using Selenium IDE in browser side bar it cannot record user operations in a pop up window opened by application.

 

12. Can I control the speed and pause test execution in Selenium IDE?

Answer:

Selenium IDE provides a slider with Slow and Fast pointers to control the speed of execution.

 

13. Where do I see the results of Test Execution in Selenium IDE?

Answer:

Result of test execution can be views in log window in Selenium IDE –

 

14. Where do I see the description of commands used in Selenium IDE?

Answer:

Commands of description can be seen in Reference section –

 

15. Can I build test suite using Selenium IDE?

Answer:

Yes, you can first record individual test cases and then group all of them in a test suite. Following this entire test suite could be executed instead of executing individual tests.

 

16. What verification points are available with Selenium?

Answer:

There are largely three type of verification points available with Selenium –

  • Check for page title
  • Check for certain text
  • Check for certain element (text box, drop down, table etc)

 

17. I see two types of check with Selenium – verification and assertion, what’s the difference between tow?

Answer:

  • A verification check lets test execution continue even in the wake of failure with check, while assertion stops the test execution. Consider an example of checking text on page, you may like to use verification point and let test execution continue even if text is not present. But for a login page, you would like to add assertion for presence of text box login as it does not make sense continuing with test execution if login text box is not present.

 

18. I don’t see check points added to my tests while using Selenium IDEL, how do I get them added to my tests?

Answer:

You need to use context menu to add check points to your Selenium IDE tests –

 

19. How do I edit tests in Selenium IDE?

Answer:

There are two ways to edit tests in Selenium IDE; one is the table view while other looking into the source code of recorded commands –

 

20. What is syntax of command used in Selenium?

Answer:

There are three entities associated with a command –

  • Name of Command
  • Element Locator (also known as Target)
  • Value (required when using echo, wait etc)

 

21. There are tons of Selenium Command, am I going to use all of them

Answer:

This entirely boils down to operations you are carrying out with Selenium. Though you would definitely be using following Selenium Commands more often –

  • Open: opens a web page.
  • click/clickAndWait: click on an element and waits for a new page to load.
  • Select: Selects a value from a drop down value.
  • verifyTitle/assertTitle: verifies/asserts page title.
  • verify/assert ElementPresent: verifies/asserts presence of element, in the page.
  • verify/assert TextPresent verifies/asserts  expected text is somewhere on the page.

 

22. How do I use html id and name while using Selenium IDE

Answer:

Html id and name can be used as it is in selenium IDE. For example Google search box has name – “q” and id – “list-b” and they can be used as target in selenium IDE –

 

23. What is XPath? When would I have to use XPath in Selenium IDE?

Answer:

XPath is a way to navigate in xml document and this can be used to identify elements in a web page. You may have to use XPath when there is no name/id associated with element on page or only partial part of name/ide is constant.

Direct child is denoted with – /

Relative child is denoted with – //

Id, class, names can also be used with XPath –

  • //input[@name=’q’]
  • //input[@id=’lst-ib’]
  • //input[@class=’lst’]

If only part of id/name/class is constant than “contains” can be used as –

  • //input[contains(@id,’lst-ib’)]

 

24. What is CSS location strategy in Selenium?

Answer:

CSS location strategy can be used with Selenium to locate elements, it works using cascade style sheet location methods in which –

Direct child is denoted with – (a space)

Relative child is denoted with – >

Id, class, names can also be used with XPath –

  • css=input[name=’q’]
  • css=input[id=’lst-ib’] or input#lst-ib
  • css=input[class=’lst’] or input.lst

If only part of id/name/class is constant than “contains” can be used as –

  • css=input[id*=’ lst-ib ‘)]

Element location strategy using inner text

  • css = a:contains(‘log out’)

 

25. There is id, name, XPath, CSS locator, which one should I use?

Answer:

If there are constant name/id available than they should be used instead of XPath and CSS locators. If not then css locators should be given preference as their evaluation is faster than XPath in most modern browsers.

More Questions (Coming Soon)

Above question & answers shared by our experienced trainer in Automation field. Seleniumlabs provides Selenium training in-class as well online training.

For more information about Selenium Training in Bangalore

Contact us: +91 9739216095

Email id: training@seleniumlabs.in

 

Comments