Q1 : How will you find an element using Selenium?
A : In Selenium every object or control in a web page is referred to 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
Q2 : What types of testing are supported by Selenium?
A : Selenium supports Regression testing and Functional testing.
Q3 : What is Selenese?
A : Selenese is a set of command in Selenium used for running a test.
Q4 : Name the three types of Selenese.
A :
- Accessors: Used for storing the values in a variable
- Actions: Used for performing the interactions and operations with the target elements
- Assertions: Used as a checkpoint
Q5 : How can you use Selenium to identify an object?
A : You can use isElementPresent (String locator) to find an object using Selenium. It takes a locator as the argument and if found, returns a Boolean.
Q6 : What are the advantages of Selenium?
A :
- It supports C#, PHP, Java, Perl, Python
- It supports different OS like Windows, Linux and Mac OS
- It has got powerful methods to locate elements (XPath, DOM, CSS)
- It has highly developer community supported by Google
Q7 : What is an assertion in Selenium?
A : An assertion is used as a verification point in Selenium. It verifies that the state of the application is as expected. The three types of assertion are:
- “assert”
- “verify”
- “waitFor”
Q8 : List out the technical challenges with Selenium?
A : Technical challenges with Selenium are
- Selenium supports only web-based applications
- It does not support the Bitmap comparison
- For any reporting, related capabilities have to depend on third-party tools
- No vendor support for tool compared to commercial tools like HP UFT
- As there is no object repository concept in Selenium, maintainability of objects becomes difficult
Q9 : What are the four parameters you have to pass in Selenium?
A : Four parameters that you have to pass in Selenium are
- Host
- Port Number
- Browser
- URL
Q10 : Why should Selenium be selected as a test tool?
A : Selenium
- is a free and open source
- have a large user base and helping communities
- have cross Browser compatibility (Firefox, Chrome, Internet Explorer, Safari etc.)
- have great platform compatibility (Windows, Mac OS, Linux etc.)
- supports multiple programming languages (Java, C#, Ruby, Python, Pearl etc.)
- has fresh and regular repository developments
- supports distributed testing
Q11 : What is an Object Repository? How is it created in Selenium?
A : An object repository allows a tester to store web elements of the Application Under Test (AUT) together with their locator values, in one or more centralized locations as opposed to hard-coding them within the test scripts.
Q12 : How you can use “submit” a form using Selenium?
A : You can use “submit” method on the element to submit form-
element.submit () ;
Alternatively, you can use click method on the element which does form submission
Q13 : Where can you use Selenium Grid?
A : Selenium Grid allows you to run multiple instances of Selenium Remote Control in parallel concurrently and makes them appear as one. By leveraging your existing computing infrastructure, it allows you to run multiple functional tests in parallel, on multiple machines, against different browsers, in a heterogeneous environment.
Q14 : What is the use of X-path?
A : X-Path is used to find the WebElement in web pages. It is also useful in identifying the dynamic elements.
Q15 : Explain the difference between Selenium 1.0 and Selenium 2.0.
A : Selenium 1.0 consists of only Selenium RC.
Selenium RC and WebDriver are consolidated into a single tool to form Selenium 2.0
Q16 : What is Selenium and what is composed of?
A : Selenium is a suite of tools for automated web testing. It is composed of
- Selenium IDE (Integrated Development Environment) : It is a tool for recording and playing back. It is a Firefox plugin
- WebDriver and RC: It provides the APIs for a variety of languages like Java, .NET, PHP, etc. With most of the browsers Webdriver and RC works.
- Grid: With the help of Grid you can distribute tests on multiple machines so that test can be run parallel which helps in cutting down the time required for running in-browser test suites
Q17 : What are the Selenium suite components?
A : The Selenium suite package consists of the following components:
- Selenium RC
- Selenium IDE (Integrated Development Environment)
- Selenium Webdriver
- Selenium Grid
Q18 : What are heightened privileges browsers?
A : The purpose of heightened privileges is similar to Proxy Injection, allows websites to do something that is not commonly permitted. The key difference is that the browsers are launched in a special mode called heightened privileges. By using this browser mode, Selenium core can open the AUT directly and also read/write its content without passing the whole AUT through the Selenium RC server.
Q19 : Explain what is the difference between find elements () and find element () ?
A : find element ():
It finds the first element within the current page using the given “locating mechanism”. It returns a single WebElement
findElements () : Using the given “locating mechanism” find all the elements within the current page. It returns a list of web elements.
Q20 : Explain how to assert text of webpage using selenium 2.0?
A : WebElement el = driver.findElement(By.id(“ElementID”))
//get test from element and stored in text variable
String text = el.getText();
//assert text from expected
Assert.assertEquals(“Element Text”, text);
Q21 : Does Selenium have limitations? If so, what are some of these limitations?
A : Yes, Selenium has limitations. These include:
- Since it is free, there is no ready vendor support. However, it has a large helping community of developers
- It cannot be used to test mobile applications
- Its user is expected to possess knowledge of programming
- Selenium cannot be used to test Captcha and Barcode readers
- Test reports can only be generated using third-party tools such as JUnit and TestNG
Q22 : How Selenium Grid works?
A : Selenium Grid sent the tests to the hub. These tests are redirected to Selenium Webdriver, which launch the browser and run the test. With the entire test suite, it allows for running tests in parallel.
Q23 : Can we use Selenium grid for performance testing?
A : Yes. But not as effectively as a dedicated Performance Testing tool like LoadRunner.
Q24 : What are the testing types that can be supported by Selenium?
A : Selenium supports the following types of testing:
- Functional Testing
- Regression Testing
Q25 : Can we test APIs or web services using Selenium web driver?
A : No selenium web driver uses browser’s native method to automate the web applications. Since web services are headless, so we cannot automate web services using selenium web driver.