February 25, 2020

Selenium interview questions for experienced

1) How will you find an element using Selenium?

In Selenium every object or control in a web page is referred as an element, there are different ways to find an element in a web page they are

  • ID
  • Name
  • Tag
  • Attribute
  • CSS
  • Linktext
  • PartialLink Text
  • Xpath etc

2) Explain what is assertion in Selenium and what are the types of assertion?

Assertion is used as a verification point. It verifies that the state of the application conforms to what is expected. The types of assertion are “assert” , “verify” and “waitFor”.

Learn more about Selenium from this informative Selenium online training!

3) Mention what is the use of X-path?

X-Path is used to find the Web Element in web pages. It is also useful in identifying the dynamic elements.

Refer Complete Guide on XPath

4) Explain the difference between single and double slash in X-path?

Single slash ‘/ ’

  • Single slash ( / ) start selection from the document node
  • It allows you to create ‘absolute’ path expressions

Double Slash ‘// ’

  • Double slash ( // ) start selection matching anywhere in the document
  • It enables to create ‘relative’ path expressions

5) What type of tests have you automated?

Our main focus is to automate test cases to do Regression testing, Smoke testing, and Sanity testing. Sometimes based on the project and the test time estimation, we do focus on End to End testing.

6) Can you explain the Framework which you have used in your Selenium Project?

Here we have clearly explained each component of Framework. Check this post to learn more about explain automation framework to the interviewer.

7) What is Selenese?

Selenese is the language which is used to write test scripts in Selenium IDE.

8) Which is the only browser that supports Selenium IDE to be used?

Firefox

9) What are the Programming Languages supported by Selenium WebDiver?

  • Java
  • C#
  • Python
  • Ruby
  • Perl
  • PHP

10) Which language is not supported by selenium?

Selenium supports all major programming languages such as Java, C#, Perl, Python, Ruby, PHP, Scala and Groovy. As of today, others are not compatible.

Go through the selenium tutorial to get a clear understanding of Selenium!

11) What are the Operating Systems supported by Selenium WebDriver?

  • Windows
  • Linux
  • Mac OS X
  • iOS
  • Android

12) How many parameters can selenium commands have at minimum?

There are four parameters that you have to pass in Selenium are

  • Host
  • Port Number
  • Browser
  • URL

Host:

It is the parameter which we use to bind Selenium to a specific IP. Usually, we run selenium tests on our local machine so the value will be ‘localhost’. You can sepcify IP address instead of localhost.

  • java -jar <selenium server standalone jar name> -host <Your IP Address>

Port Number:

TCP/IP port which is used to connect selenium tests to the selenium grid hub. Default port hub is 4444.
java -jar <selenium server standalone jar name> -role hub -port 4444

  • Make sure no other application in your system is using this port. You may face an exception like Exception in thread “main” java.net.BindException: Selenium is already running on port 4444. Or some other service is.
  • If this occurs you can either shutdown the other process that is using port 4444, or you can tell Selenium-Grid to use a different port for its hub. Use the -port option for changing the port used by the hub.
  • java -jar <selenium server standalone jar name> -role hub -port 4441

Browser:

To pass the browser which has to execute our selenium scripts

URL:

To pass the application URL

13) What are the Open-source Frameworks supported by Selenium WebDriver?

  • JUnit
  • TestNG
Interested in learning Selenium? Check out our Selenium interview questions!

14) What Does A Single Slash “/” Mean In XPath?

A single (forward) slash “/” represents the absolute path.

In this case, the XPath engine navigates the DOM right from the first node.

15) What Does A Double Slash “//” Mean In XPath?

A double (forward) Slash “//” represents the relative path.

In this case, the XPath engine searches for the matching element anywhere in the DOM.

16) How Do You Use “Class” As A CSS Selector?

We can use the below syntax to access elements using the class CSS selector.

.<class>

e.g. .color

It can help to select all elements related to the specified class.

17) How do I set the test case priority in TestNG?

SettingPriority in TestNG:

Test Execution Sequence:

· Method1

· Method2

· Method3

18) For the database testing in Selenium WebDriver, what API is required?

For the database testing in Selenium WebDriver, we need the JDBC (Java Database Connectivity) API. It allows us to execute SQL statements.

Learn more about Selenium in this Selenium online training Hyderabad to get ahead in your career!