Selenium

  Home  Software Testing  Selenium


“Selenium frequently Asked Questions by expert members with experience in Selenium. These questions and answers will help you strengthen your technical skills, prepare for the new job test and quickly revise the concepts”



66 Selenium Questions And Answers

21⟩ How to debug the tests in Selenium IDE?

To debug or execute the test cases line by line. Follow the below mentioned steps

1. Insert a break point (see the question to know more How to insert a break point in Selenium IDE? ) from the locationwhere you want to execute step by step

2. Run the test case

3. execution will be paused at the given break point

4. Click on the step (Blue) button to continue with the next statement

5. Click on Run button, to continue executing all the commands at a time

 179 views

22⟩ How to export Selenium IDE Test Suite to Selenium RC Suites?

From selenium IDE the test cases can be exported into the languages as mentioned below

1. .Net, 2. Java, 3. Perl, 4. Python, 5. PHP, 6. Ruby

The below mentioned steps can explain how to export the test cases

1. Open the test case from Selenium IDE

2. Select File -> Export Test Case As

 177 views

23⟩ Which is the command used for displaying the values of a variable into the output console or log?

The command used for displaying the values of a variable into the output console or log - echo

If you want to display a constant string. The below mentioned command can be used

echo <constant string>

ex: echo "The sample message"

If you want to display the value of a variable it can be written like below

echo ${<variable name>>

ex: echo ${var1}

Note: Here var1 is the variable

 200 views

24⟩ Which are the browsers supported by Selenium RC?

Supported browsers for Selenium RC include:

(1). *firefox (2). *mock (3). *firefoxproxy (4). *pifirefox ((5). *chrome (6). *iexploreproxy (7). *iexplore (8). *firefox3 (9). *safariproxy (10). *googlechrome (11). *konqueror (12). *firefox2 (13). *safari (14). *piiexplore (15). *firefoxchrome (16). *opera (17). *iehta

(18). *custom

Note: Any third party browser is supported with *custom followed by the complete path of the browser with executable

 180 views

25⟩ Which are the Operating Systems supported by Selenium?

Selenium IDE

Works in Firefox 2+ Start browser, run tests Run tests

Operating Systems Supported:

1. Windows, 2. OS X 3. Linux 4. Solaris 5. Others whichever supports Firefox 2+

Selenium Remote Control

Used for starting browser and run tests

Operating Systems Supported:

1. Windows, 2. OS X 3. Linux 4. Solaris 5. Others

Selenium Core

Used for running tests

Operating Systems Supported:

1. Windows, 2. OS X 3. Linux 4. Solaris 5. Others

 174 views

26⟩ What is Selenium RC?

Selenium-RC is the solution for tests that need a little more than just simple browser actions and a linear execution. Selenium-RC leverages the full power of programming languages, creating tests that can do things like read and write external files, make queries to a database, send emails with test reports, and practically anything else a user can do with a normal application.

You will want to use Selenium-RC whenever your test requires logic not supported by running a script from Selenium-IDE

 173 views

27⟩ Why Selenium RC is used?

Selenium-IDE does not directly support:

1. condition statements

2. iteration

3. logging and reporting of test results

4. error handling, particularly unexpected errors

5. database testing

6. test case grouping

7. re-execution of failed tests

8. test case dependency

9. capture screenshots on test failures

The reason behind why Selenium-IDE does not support the above mentioned requirements is IDE supports only HTML language. Using HTML language we cannot achieve the above mentioned requirements. Because HTML does not support conditional, looping and external source connectives.

To overcome the above mentioned problems Selenium RC is used.

Since Selenium RC supports the languages .Net, Java, Perl, Python, PHP, and Ruby. In these languages we can write the programme to achieve the IDE issues

 174 views

29⟩ What is Selenium Grid?

Selenium Grid is part of Selenium suite of projects. Selenium Grid transparently distribute your tests on multiple machines so that you can run your tests in parallel, cutting down the time required for running in-browser test suites. This will dramaticallyspeeds up in-browser web testing, giving you quick and accurate feedback you can rely on to improve your web application.

 238 views

30⟩ What is Selenium WebDriver or Google WebDriver or Selenium 2.0?

WebDriver uses a different underlying framework from Selenium’s javascript Selenium-Core. It also provides an alternative API with functionality not supported in Selenium-RC. WebDriver does not depend on a javascript core embedded within the browser, therefore it is able to avoid some long-running Selenium limitations.

WebDriver’s goal is to provide an API that establishes

• A well-designed standard programming interface for web-app testing.

• Improved consistency between browsers.

• Additional functionality addressing testing problems not well-supported in Selenium 1.0.

The Selenium developers strive to continuously improve Selenium. Integrating WebDriver is another step in that process. The developers of Selenium and of WebDriver felt they could make significant gains for the Open Source test automation community be combining forces and merging their ideas and technologies. Integrating WebDriver into Selenium is the current result of those efforts.

 183 views

32⟩ What is the architecture of Selenium RC?

The Selenium Server which launches and kills browsers, and acts as an HTTP proxy for browser requests.

Client libraries for various programming languages, each of which instructs the Selenium Server in how to test the AUT bypassing it your test script’s Selenium commands.

The diagram shows the client libraries communicate with the Server passing each Selenium command for execution. Then the server passes the Selenium command to the browser using Selenium-Core JavaScript commands. The browser, using its JavaScript interpreter, executes the Selenium command, which effectively, runs the check you specified in your Selenese test script.

 186 views

33⟩ What is the architecture of Selenium Grid?

Selenium Grid builds on the traditional Selenium setup, taking advantage of the following properties:

* The Selenium test, the application under test, and the remote control/browser pair do not have to be co-located. They communicate through HTTP, so they can all live on different machines.

* The Selenium tests and the web application under test are obviously specific to a particular project. Nevertheless, neither the Selenium remote control nor the browser is tied to a specific application. As a matter of fact, they provide a capacity that can easily be shared by multiple applications and multiple projects.

Consequently, if only we could build a distributed grid of Selenium Remote Controls, we could easily share it across builds, applications, projects - even potentially across organizations. Of course we would also need to address the scalability issues as described earlier when covering the traditional Selenium setup. This is why we need a component in charge of:

* Allocating a Selenium Remote Control to a specific test (transparently)

* Limiting the number of concurrent test runs on each Remote Control

* Shielding the tests from the actual grid infrastructure

Selenium Grid calls this component the Selenium Hub.

* The Hub exposes an external interface that is exactly the same as the one of a traditional Remote Control. This means that a test suite can transparently target a regular Remote Control or a Selenium Hub with no code change. It just needs to target a different IP address. This is important as it shields the tests from the grid infrastructure (which you can scale transparently). This also makes the developer’s life easier. The same test can be run locally on a developer machine, or run on a heavy duty distributed grid as part of a build – without ever changing a line of code.

* The Hub allocates Selenium Remote Controls to each test. The Hub is also in charge of routing the Selenese requestsfrom the tests to the appropriate Remote Control as well as keeping track of testing sessions.

* When a new test starts, the Hub puts its first request on hold if there is no available Remote Control in the grid providing the appropriate capabilities. As soon as a suitable Remote Control becomes available, the Hub will serve the request. For the whole time, the tests do not have to be aware of what is happening within the grid; it is just waiting for an HTTP response to come back.

 196 views

34⟩ 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.

 175 views

37⟩ How to use regular expressions in Selenium?

Regular expressions in Selenium IDE can be used with the keyword - regexp: as a prefix to the value and patterns needs to be included for the expected values.

For example if you want to use the regular expression for a command

Command: verifyText

Target: //font/font/b/font[1]

Value: Flight Confirmation # 2011-05-02451

in the above example Flight Confirmation is continuously changing each time you run the test case. So this can be writtenwith a regular expression as mentioned below

Command: verifyText

Target: //font/font/b/font[1]

Value: regexp:Flight Confirmation # [0-9]{4}-[0-9]{2}-[0-9]{5,10}

 188 views

38⟩ What are the regular expression patterns available in Selenium?

Selenium regular expression patterns offer the same wide array of special characters that exist in JavaScript. Below are a subset of those special characters

.

any single character

[ ]

character class: any single character that appears inside the brackets

*

quantifier: 0 or more of the preceding character (or group)

+

quantifier: 1 or more of the preceding character (or group)

?

quantifier: 0 or 1 of the preceding character (or group)

{1,5}

quantifier: 1 through 5 of the preceding character (or group)

|

alternation: the character/group on the left or the

character/group on the right

( )

grouping: often used with alternation and/or quantifier

 179 views

39⟩ What is Selenese?

Selenium set of commands which are used for running the test are called as Selenese.

There are three types of Selenese, those are:

1. Actions - used for performing the operations and interactions with the target elements

2. Assertions - used as check points

3. Accessors - used for storing the values in a variable

 177 views