Since there is so much dependency on the web today, ensuring up-time and functioning of web apps is an evident need. Selenium is an automation testing tool developed precisely for that purpose, and this blog lists the frequently asked Selenium Interview Questions for those(freshers & experienced) planning to get into testing domain.
Putting the technical questions aside, you might also be asked few Selenium tricky interview questions, pertaining to why only Selenium, and not any other tool? That is because Selenium is open source and it’s easy adoption has earned itself the tag of being the poster boy of web testing tools. With a whopping 300 percent increase in job postings over the past three years, testing has presented itself as an entry point into the IT world for professionals from various domains. Organizations are hunting for professionals with Selenium certification.
- How can tests be debugged in Selenium IDE? …
- What is the need to use TestNG with Selenium RC? …
- How do you handle a frame in Selenium WebDriver? …
- Consider a situation: Selenium Script runs in Chrome, but not in IE. …
- Can you use Selenium to conduct responsive Web design testing?
Selenium Interview Questions and Answers | Scenario based and some tricky Questions with Answers
41. Explain what is Group Test in TestNG?
In TestNG, methods can be categorized into groups. When a particular group is being executed, all the methods in that group will be executed. We can execute a group by parameterizing it’s name in group attribute of @Test annotation. Example: @Test(groups={“xxx”})
48. What are the features of TestNG?
Selenium does not support Database Testing, still, it can be partially done using JDBC and ODBC.
12. How to scroll down a page using JavaScript in Selenium?
We can scroll down a page by using window.scrollBy() function. Example:
10. Write a code to wait for a particular element to be visible on a page. Write a code to wait for an alert to appear.
We can write a code such that we specify the XPath of the web element that needs to be visible on the page and then ask the WebDriver to wait for a specified time. Look at the sample piece of code below:
Similarly, we can write another piece of code asking the WebDriver to wait until an error appears like this:
8. What is Page Factory?
Page Factory gives an optimized way to implement Page Object Model. When we say it is optimized, it refers to the fact that the memory utilization is very good and also the implementation is done in an object oriented manner.
Page Factory is used to initialize the elements of the Page Object or instantiate the Page Objects itself. Annotations for elements can also be created (and recommended) as the describing properties may not always be descriptive enough to differentiate one object from the other.
The concept of separating the Page Object Repository and Test Methods is followed here also. Instead of having to use ‘FindElements’, we use annotations like: @FindBy to find WebElement, and initElements method to initialize web elements from the Page Factory class.
@FindBy can accept tagName, partialLinkText, name, linkText, id, css, className & xpath as attributes.