Selenium Interview Questions

Get Technical Answers for Selenium Interview Questions by Selenium Expert Developer, Advanced Technical Questions for Freshers and Experience Persons. Free Practical test

1. How Do You Verify An Object Presented In Multiple Pages?

Check on each page

assertTrue(selenium.isElementPresent(locator));

2. How Do You Capture An Element Loading After The Page Load?

provide a time to check the element( in seconds) Like :

 

public void waitForElementPresent(String element, int timeout) throws Exception

{

for (int second = 0;; second++)

{

if (second >= timeout)

fail("Timeout.Unable to find the Specified element"+element);

try

{

   if (selenium.isElementPresent(element)) break;

}

catch (Exception e) { }

Thread.sleep(1000);

}

}

Selenium Certification Training

  • Master Your Craft
  • Lifetime LMS & Faculty Access
  • 24/7 online expert support
  • Real-world & Project Based Learning

 

3. What Is Selenium ?

Selenium is a portable software testing framework for web applications.

The tests can be written as HTML tables or coded in a number of popular programming languages and can be run directly in most modern web browsers.

Selenium operations are highly flexible, allowing many options for locating UI elements and comparing expected test results against actual application behavior.

Selenium can be deployed on Windows, Linux, and Macintosh.

Selenium is used for UAT (User Acceptance Test)

Subscribe to our youtube channel to get new updates..!

 

4. Why And When To Automate?

Frequent regression testing

Repeated test case Execution is required

User Acceptance Tests

Faster Feedback to the developers

Reduce the Human Effort

Test same application on multiple environments

Selenium Certification Training

Weekday / Weekend Batches

 

5. What Are The Components Of Selenium ?

Selenium IDE

Selenium Remote Control

Selenium Grid

6. Explain About Selenium-ide ?

Selenium IDE is an integrated development environment for Selenium tests.

Operates as a Firefox add-on and provides an interface for developing and running individual test cases or entire test suites.

Selenium-IDE has a recording feature, which will keep account of user actions as they are performed and store them as a reusable script to play back.

It also has a context menu (right-click) integrated with the Firefox browser, which allows the user to pick from a list of assertions and verifications for the selected location.

Offers full editing of test cases.

Although it is a Firefox only add-on, tests created in it can also be run against other browsers by using Selenium-RC & specifying the name of the test suite on the command line.

7. What Are The Features Of Selenium Ide ?

Record and playback

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 and set breakpoints

Save texts 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

 

8. What Is Selenium-rc (remote Control) ?

Selenium-RC provides an API (Application Programming Interface) and library for each of its supported languages: HTML, Java, C#, Perl, PHP, Python, and Ruby. Selenium-RC allows the test automation developer to use a programming language for maximum flexibility and extensibility in developing test logic.

 

For instance, if the application under test returns a result set, and if the automated test program needs to run tests on each element in the result set, the programming languages iteration support can be used to iterate through the result set, calling Selenium commands to run tests on each item.

9. Explain About Selenium-grid ?

Selenium-Grid allows the Selenium-RC solution to scale for test suites or test suites to be run in multiple environments.

 

With Selenium-Grid multiple instances of Selenium-RC are running on various operating system and browser configurations, each of these when launching register with a hub. When tests are sent to the hub they are then redirected to an available Selenium-RC, which will launch the browser and run the test.

 

This allows for running tests in parallel, with the entire test suite theoretically taking only as long to run as the longest individual test.

10. What Are The Selenese Commands In Selenium ?

clicking a link - click or clickAndWait commands

entering values - type command

selecting options from a drop-down listbox - select command

clicking checkboxes or radio buttons - click command

 

11. What Is Test Runner ?

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

 

12. What Are The Running Options In Selenium ?

Run a Test Case: Click the Run button to run the currently displayed test case.

Run a Test Suite: Click the Run All button to run all the test cases in the currently loaded test suite.

Stop and Start: The Pause button can be used to stop the test case while it is running. The icon of this button then changes to indicate the Resume button. To continue click Resume.

Stop in the Middle: Set a breakpoint in the test case to cause it to stop on a particular command. This is useful for debugging your test case. To set a breakpoint, select a command, right-click, and from the context menu select Toggle Breakpoint.

Start from the Middle: We can set the IDE to begin running from a specific command in the middle of the test case. This also is used for debugging. To set a start point, select a command, right-click, and from the context menu select Set/Clear Start Point.

Run Any Single Command: Double-click any single command to run it by itself. This is useful when writing a single command. It lets you immediately test a command you are constructing, when you are not sure if it is correct. You can double-click it to see if it runs correctly. This is also available from the context menu.

13. What Are The Assertion Statements In Selenium ?

assertTextPresent : This will assert if the text is present in the page.

assertText: 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.

14. Explain Selenium Waitfor Commands ?

waitForPageToLoad : This command will make the script to wait till the page loads.Syntax is waitForPageToLoad(timeout); Timed 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

15. What Are The Advantages And Disadvantages Of Selenium ?

Advantages

 

Supports C#, Java, PHP, Perl, Python

Supported on Windows, Linux and Mac OS

Highly active developer community - backed by Google

Powerful methods to locate elements (Xpath, CSS, DOM)

Disadvantages

 

Challenges running on browsers other than Firefox

Difficulty to automate AJAX

Limitations to automate Applets, MS and Desktop Applications

16. What Is Selenium Ide?

Selenium IDE is an integrated development environment for Selenium tests. It is implemented as a Firefox extension, and has a recording feature, which will keep account of user actions as they are performed and store them as a reusable script to play back. Selenium-IDE also offers full editing of test cases for more precision and control.

17. Selenium Test A Application On Iphone Mobile Safari Browser?

Selenium can handle Mobile Safari browser. There is experimental Selenium IPhone Driver for running tests on Mobile with Safari on the iPhone and iPad and iPod Touch.

18. Can Selenium Test An Application On Android Browser?

Selenium can handle Android browser.

19. How To Start The Selenium Server From Your Language Class?

try {

seleniumServer = new SeleniumServer();

seleniumServer.start();

} catch (Exception e) {

e.printStackTrace();

}

20. But My Tests Need Me To Exercise Objects Outside Browser, How Do I Achieve It?

You can use Robot class in java to achieve this, but it would be dirty solution even if you get through this.

21. What Are The Technical Challenges With Selenium?

As you know Selenium is a free ware open source testing tool. There are many challenges with Selenium.

 

Selenium supports only web based applications.

It doesn’t support any non web based (Like Win 32, Java Applet, Java Swing, .Net Client Server etc) applications.

When you compare selenium with QTP, Silk Test, Test Partner and RFT, there are many challenges in terms of maintainability of the test cases.

Since Selenium is a freeware tool, there is no direct support if one is in trouble with the support of applications.

There is no object repository concept in Selenium, so maintainability of the objects is very high

There are many challenges if one have to interact with Win 32 windows even when you are working with Web based applications.

Bitmap comparison is not supported by Selenium.

Any reporting related capabilities, you need to depend on third party tools.

You need to learn any one of the native language like (.Net, Java, Perl, Python, PHP, Ruby) to work efficiently with the scripting side of selenium.

22. How To Run Test Case Recorded Using Selenium Ide In Other Browsers?

Running test case recorded with the help of Selenium Remote Control.

23. What Is The Selenium's Recording Language?

Selenium’s recording language is “HTML”.

24. What Are The Steps To Run Automation Using Selenium?

The very basic steps are:

 

Record the test steps using selenium-IDE.

Modify the script according to the testing needs. Add validation points, Java Scripts, Time-out etc.

Run the test.

View the result after test run complete analyze.

25. What Are The Capabilities Of Selenium Ide?

Selenium IDE (Integrated Development Environment) works similar to commercial tools like QTP, Silk Test and Test Partner etc. The below points describes well about Selenium IDE.

 

Selenium IDE is a Firefox add-on.

Selenium IDE can support recording the clicks, typing, and other actions to make a test cases.

Using Selenium IDE, a tester can play back the test cases in the Firefox browser.

Selenium IDE supports exporting the test cases and suites to Selenium RC.

Debugging of the test cases with step-by-step can be done.

Breakpoint insertion is possible.

Page abstraction functionality is supported by Selenium IDE.

Selenium IDE can supports an extensibility capability allowing the use of add-ons or user extensions that expand the functionality of Selenium IDE.

26. Describe Technical Problems That You Had With Selenium Tool?

As with any other type of test automation tools like SilkTest, HP QTP, Watir, Canoo Webtest, Selenium allows to record, edit, and debug tests cases. However there are several problems that seriously affect maintainability of recorded test cases, occasionally Quality Assurance Engineers complain that it takes more time to maintain automated test cases than to perform manual testing; however this is an issue with all automated testing tools and most likely related to improper testing framework design. Another problem is complex ID for an HTML element. If IDs is auto-generated, the recorder test cases may fail during playback. The work around is to use XPath to find required HTML element. Selenium supports AJAX without problems, but QA Tester should be aware that Selenium does not know when AJAX action is completed, so ClickAndWait will not work. Instead QA tester could use pause, but the snowballing effect of several 'pause' commands would really slow down total testing time of test cases. The best solution would be to use waitForElement.

27. What Test Can Selenium Do?

Selenium could be used for the functional, regression, load testing of the web based applications. The automation tool could be implemented for post release validation with continuous integration tools like Jenkins, Hudson, QuickBuild or CruiseControl.

28. What Is The Price Of Selenium License Per Server?

Selenium is open source software, released under the Apache 2.0 license and can be downloaded and used without charge.

29. How Much Does Selenium License Cost Per Client Machine?

Selenium is open source software, released under the Apache 2.0 license and can be downloaded and used without charge.

30. Where To Download Selenium?

Selenium can be downloaded and installed for free from seleniumhq.org

 

Submit an interview question

Categories

Request for more information

Webinar

Python tutorial for beginners

5th April | 08:00 AM

150 Registered

praneetha
praneetha
servicenow developer
Praneetha is a Post Graduate in Computer Science from Andhra University .She is currently working as an IT developer at hkr trainings.com. And she has great experience includes both IT development and operational roles. Connect with her also on LinkedIn and Twitter. Thank you

To Top