Selenium Interview Questions
- What is Selenium ? different selenium components?
Answer: Selenium is one of the most popular automated testing suites. It is designed for web application based automated testing.
Selenium components: Selenium IDE, Selenium RC, Selenium WebDriver, Selenium Grid.
- What are the types of testing supported by Selenium?
- Functional Testing,
- Regression Testing
- What is Selenese?
It is the language which is used to write test scripts in Selenium IDE.
- What are the different locators used in Selenium?
- CSS Selector
- What is the difference between “/” and “//” in Xpath?
Single Slash(“/”) : It is used to create Xpath with absolute path.
Double Slash(“//”): It is used to create Xpath with relative path.
6.Can Selenium handle windows based pop up?
Selenium is an automation testing tool which supports only web application testing. Therefore, windows pop up cannot be handled using Selenium.
- Why Should Selenium be selected as an automation tool?
- is free and open source
- have a large user base and active communities
- have cross browser compatibility(Chrome, Internet Explorer, Safari, Firefox etc..)
- have great platform compatibility(Windows, Mac, OS, Linux, etc..)
- Supports multiple programming languages(Java, C#, Ruby, Python, Perl, etc..)
- has fresh and regular repository developments
- supports distributed testing
- What are the limitations of Selenium?
- Selenium supports testing of only web based applications
- Mobile applications cannot be tested using Selenium
- Captcha and Bar code readers cannot be tested using Selenium
- Reports can only be generated using third party tools like TestNG or Junit
- As Selenium is a free tool, thus there is no ready vendor support though the user can find numerous helping communities
- User is expected to possess prior programming language knowledge
- What is difference between assert and verify commands?
Assert command checks whether the given condition is true or false. Let’s say we assert whether the given element is present on the web page or not. If the condition is true then the program control will execute the next test step but if the condition is false, the execution would stop and no further test would be executed.
Verify command also checks whether the given condition is true or false. Irrespective of the condition being true or false, the program execution doesn’t halts i.e. any failure during verification would not stop the execution and all the test steps would be executed
- What is an Xpath?
Xpath is used to locate a web element based on its XML path. XML stands for Extensible Markup Language and is used to store, organize and transport arbitrary data. It stores data in a key – value pair which is very much similar to HTML tags. Both being markup languages and since they fall under the same umbrella, Xpath can be used to locate HTML elements. The fundamental behind locating elements using Xpath is the traversing between various
elements across the entire page and thus enabling a user to find an element with the reference of another element.
- When should I use Selenium Grid?
Selenium Grid can be used to execute same or different test scripts on multiple platforms and browsers concurrently so as to achieve distributed test execution, testing under different environments and saving execution time remarkably.
- Which is the only browser that supports Selenium IDE to be used?
- What is Selenium RC?
- What is Selenium WebDriver?
Ans. Selenium WebDriver AKA Selenium 2 is a browser automation framework that accepts commands and sends them to a browser. It is implemented through a browser-specific driver. It controls the browser by directly communicating with it. Selenium WebDriver supports Java, C#, PHP, Python, Perl, Ruby.
- What is Selenium Grid?
Ans. Selenium Grid is a tool used together with Selenium RC to run tests on different machines against different browsers in parallel. That is, running multiple tests at the same time against different machines running different browsers and operating systems.
In simple words, it is used to distribute your test execution on multiple platforms and environments concurrently.
- When do you use Selenium Grid?
Ans. Selenium Grid can be used to execute same or different test scripts on multiple platforms and browsers concurrently so as to achieve distributed test execution
- What are the advantages of Selenium Grid?
Ans. It allows running test cases in parallel thereby saving test execution time.
It allows multi-browser testing
It allows us to execute test cases on multi-platform
- What is a hub in Selenium Grid?
Ans. A hub is a server or a central point that controls the test executions on different machines.
- What is a node in Selenium Grid?
Ans. Node is the machine which is attached to the hub. There can be multiple nodes in Selenium Grid.
- What are the types of WebDriver APIs available in Selenium?
- Firefox Driver
- Gecko Driver
- InternetExplorer Driver
- Chrome Driver
- HTMLUNIT Driver
- Opera Driver
- Safari Driver
- Android Driver
- iPhone Driver
- What is the difference between find elements () and find element () ?
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.
22.Explain how you can login into any site if it is showing any authentication popup for password and username?
Pass the username and password with url
- Syntax http://username:password@url
- example http://joby:firstname.lastname@example.org
23.Mention why to choose Python over Java in Selenium?
- Java programs tend to run slower compared to Python programs.
- Java uses traditional braces to start and ends blocks, while Python uses indentation.
- Java employs static typing, while Python is dynamically typed.
- Python is simpler and more compact compared to Java.