Selenium Interview Questions

Selenium Interview Questions and Answers
1) What is Selenium?
 

•    Selenium is a suite of software tools to automate web applications.
•    Selenium is Open source software, anybody can download and use.
•    Selenium supports various programming languages (Java, C#, PHP, Perl, Python and Ruby) to enhance test cases.
•    Selenium can be deployed on Windows, Linux, and Macintosh.
•    Selenium Supports Mizilla Firefox, IE, Google Chrome, Opera, Safari etc... browsers to execute test cases.

2) What are different components or suite of tools of selenium?
 

•    Selenium IDE
•    Selenium Remote Control
•    Selenium Grid
•    Selenium WebDriver

3) What is Selenium IDE?
 

Selenium IDE is a Firefox add-on that records clicks, typing, and other actions to make a test cases, which QA Tester can play back in the Firefox browser or export to Selenium RC.
Selenium IDE has the following features: record/play feature, debugging with step-by-step and breakpoints, page abstraction functionality, an extensibility capability allowing the use of add-ons or user extensions that expand the functionality of Selenium IDE

4) What are the Features of Selenium IDE?
•    Record and playback test cases and test suites.
•    Intelligent field selection will use IDs, names, or XPath as needed
•    Auto complete for all common Selenium commands
•    Walk through test cases and test suites.
•    Debug test cases and set breakpoints
•    Save tests as HTML, Ruby scripts, or other formats
•    Support for Selenium user-extensions.js file
•    Option to automatically assert the title of every page
•    Rollup common commands

5) What are the limitations of Selenium IDE?
 

Selenium IDE has many great features and is a fruitful and well-organized test automation tool for developing test cases, in the same time Selenium IDE is missing certain vital features of a testing tool: conditional statements, loops, logging functionality, exception handling, reporting functionality, database testing, re-execution of failed tests and screenshots taking capability.
Selenium IDE doesn't for IE, Chrome, Safari and Opera browsers, supports only Mozill Firefox Browser.

6) What is Selenium Remote Control (RC) tool?
 

Selenium Remote Control (RC) is the powerful solution for test cases that need more than simple browser actions and linear execution. Selenium-RC allows the developing of complex test scenarios like reading and writing files, querying a database, and emailing test reports. These tasks can be achieved by tweaking test cases in your preferred programming language.

7) What is Selenium Grid?
 

Selenium Grid extends Selenium RC, Selenium Webdriver to distribute our test cases across multiple machines, saving our time by running test cases in parallel.

8) How Selenium Grid works?
 

Selenium Grid sent the tests to the hub. Then tests are redirected to an available Selenium RC, which launch the browser and run the test. Thus, it allows for running tests in parallel with the entire test suite.

9) What is Selenium WebDriver?
 

Selenium WebDriver is a tool for writing automated tests of websites. It is an API name and aims to mimic the behaviour of a real user, and as such interacts with the HTML of the application. Selenium WebDriver is the successor of Selenium Remote Control which has been officially deprecated.

10) How many browsers are supported by Selenium Remote Control?
 

QA Engineer can use Firefox , IE , Safari  and Opera  browsers to run actual tests in Selenium RC.

11) How many programming languages can you use in Selenium RC?
 

Several programming languages are supported by Selenium Remote Control - C#, Java, Perl, PHP, Python, Ruby.

12) How many testing framework can QA Tester use in Selenium RC?
 

Testing frameworks aren't required, but they can be helpful if QA Tester wants to automate test cases. Selenium RC supports Bromine, JUnit, NUnit, RSpec (Ruby), Test::Unit (Ruby), TestNG (Java), unittest (Python).

13) List out the test types that are supported by Selenium?
 

For web based application testing selenium can be used
The test types can be supported are
•    Functional
•    Regression
For post release validation with continuous integration automation tool could be used
•    Jenkins
•    Hudson
•    Quick Build
•    CruiseCont

14) What do we mean by Selenium 1 and Selenium 2?
 

> Selenium RC and WebDriver, in a combination are popularly known as Selenium 2.0
> Selenium RC alone is also referred as Selenium 1.0

15)What are the different types of Element Locators in Selenium?
 

Element Locator can be termed as an address that identifies a web element uniquely within the webpage. Thus, to identify web elements accurately and precisely we have different types of locators in Selenium:

•    id
•    name
•    className
•    tagName
•    linkText
•    partialLinkText
•    cssSelector
•    xpath

16) What is an Xpath?
 

Xpath is used to locate a web element based on its XML path. XML stands for Extensible Mark-up 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 reference of another element.

17) 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

18) List out the technical challenges with Selenium?
 

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

19) What is selenese?
 

Selenium set of commands that run our test is called Selenese. A sequence of these commands is a test script. There are three types of selenese.
•    Actions: They perform some operations like clicking a link or typing text in text box or selecting an option from drop-down box etc.
•    Assertions: They verify that the state of application conforms to what is expected. Ex: 'verify that this checkbox is checked', 'make sure that the page title is X'.
•    Accessors: Checks the state of application and store the results in a variable. Ex: storeText, storeTitle, etc...

20) What are the Selenese Commands in Selenium?
 

•    Clicking a link - click or clickAndWait commands
•    Entering values - type command
•    Selecting options from a drop-down list box - select command
•    Clicking checkboxes or radio buttons - click command

21) What is the difference between assert and verify?
 

When an 'assert' fails, the test is aborted whereas when 'verify' fails, the test will continue execution logging the failure.

'Assert' is used when the expected value is mandatory to continue with next set of steps. However 'verify' is used when the expected value is optional to continue with the next set of steps.

22) What are the advantages of selenium WebDriver?
 

Selenium WebDriver is very flexible to use with Java, .Net, Python, Ruby, PHP or Perl languages. QA engineers who have good coding skills can use it very effectively.

23) What are the disadvantages of selenium WebDriver over selenium 1.0? 


Since selenium webdriver requires coding skills, QA engineers should have some knowledge of program development in Java, .Net, or other languages.

24) What are the different types of Drivers available in Web Driver?
 

The different drivers available in WebDriver are:
•    FirefoxDriver
•    InternetExplorerDriver
•    ChromeDriver
•    SafariDriver
•    OperaDriver
•    AndroidDriver
•    IPhoneDriver
•    HtmlUnitDriver

25) What are the different types of waits available in WebDriver?
 

There are two types of waits available in WebDriver:
•    Implicit Wait
•    Explicit Wait

Implicit Wait: Implicit waits are used to provide a default waiting time (say 30 seconds) between each consecutive test step/command across the entire test script. Thus, subsequent test step would only execute when the 30 seconds have elapsed after executing the previous test step/command.
Explicit Wait: Explicit waits are used to halt the execution till the time a particular condition is met or the maximum time has elapsed. Unlike Implicit waits, explicit waits are applied for a particular instance only.

26) Does Selenium support mobile internet testing?
 

Selenium supports Opera and opera is used in most of the Smart phones. So whichever Smart phone supports opera, selenium can be used to test. So, one can use Selenium RC to run the tests on mobiles.

27) Is it possible to use Selenium for multi-user Load Testing?
 

Yes, but it requires a LOT of hardware. We recommend you check out Browser Mob, which does load testing with real browsers and is powered by Selenium.

28) What is Test Runner?
 

Test Runner allows you to run the test case in a browser loaded with the Selenium-Core Test Runner. Test runner is invoked by clicking the below Shown button in the IDE.

29) What are the Assertion Statements in Selenium?
 

•    assertTextPresent: This will assert if the text is present in the page.
•    assert Text: This will assert if a particular element is having the particular text.
•    assertTitle: This will assert if the page is having a proper title.
•    assertValue: This will assert if a Text box or check box has a particular value
•    assertElementPresent: This will assert if a particular UI Element is present in the page.

30) Explain Selenium WaitForCommands?
 

•    waitForPageToLoad: This command will make the script to wait till the page loads. Syntax is waitForPageToLoad(timeout); Time out is the maximum time the script will wait for the page to load.
•    waitForAlert : This command will wait for the alert message to appear
•    waitForTable: This command will wait for the Web table to completely load in the page
•    waitForTitle: This command will for the page Title to appear on the browser.
•    Other waitFor commands: Selenium has several other wait command like waitForText, waitForPopup and so on. These commands are generically called Synchronization commands.

31) What is heightened privileges browsers?
 

The purpose of heightened privileges is similar to Proxy Injection, allows websites to do something that are not commonly permitted.  The key difference is that the browsers are launched in a special mode called heightened privileges.  By using these 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.

32) What is one big difference between SilkTest and Selenium, excluding the price?
 

•    SilkTest is a test automation solution for development, quality and business teams who need to deliver software faster.
•    With SilkTest you can create and execute tests across multiple platforms and devices to ensure that your applications work exactly as intended.
•    In Selenium, we create tests with Selenium IDE and run it with multiple platforms by using WebDriver.

33) What is the difference between Thread.Sleep() and Selenium.setSpeed ()?
 

Selenium.setSpeed:
•    Takes a single argument in string format. ex: selenium.setSpeed(“2000?) – will wait for 2 seconds
•    Runs each command in after setSpeed delay by the number of milliseconds mentioned in setSpeed.

Thread.sleep:
•    Takes a single argument in integer format. Ex: thread.sleep(2000) – will wait for 2 seconds
•    Waits for only once at the command given at sleep.

34) Why testers should opt for Selenium and not UFT?
 

Selenium is more popular than UFT as
•    Selenium is an open source whereas UFT is a commercial tool
•    Selenium is used specially for testing web based applications while UFT can be used for testing client server application also
•    Selenium supports Firefox, IE, Opera, and Safari on operating systems like Windows, Mac, Linux etc. however UFT is limited to Internet Explorer on Windows.
•    Selenium supports many programming languages like Ruby, Perl, Python whereas UFT supports only VB script

35) What are the Advantages and Disadvantages of Selenium?
 

Advantages:
•    Supports C#, Java, PHP, Perl, Phython and Ruby languages.
•    Supports MS Windows, Linux and Mac OS
•    Supports various browsers like Mozilla Firefox, IE, Chrome etc...
•    Highly active developer community - backed by Google
•    Powerful methods to locate elements (id, name, Xpath, CSS etc...)

Disadvantages:
•    Doesn't support Desktop Applications.
•    No centralized maintenance of Objects
•    Since it is open source software, no reliable support from anybody.
•    Challenges running on browsers other than Firefox
•    Difficult to automate AJAX
•   

36) What are the Frameworks used in Selenium?
 

•    JUnit
•    TestNG

37) How to inspect elements in Selenium?
 

•    Using Firebug and Firepath plug ins in Mozilla Firefox.
•    Using Developers tools (Built in) in IE and Chrome Browsers.

38) What are the advantages of TestNG framework?
 

•    Grouping Test cases
•    Generating HTML test reports
•    Data Driven Testing
•    Parallel Testing etc...

0 comments:

Post a Comment