Selenium Remote Control

  Home  Software Testing  Selenium Remote Control


“Selenium RC frequently Asked Questions in various Selenium Remote Control job Interviews by interviewer. The set of questions here ensures that you offer a perfect answer posed to you. So get preparation for your new job hunting”



17 Selenium Remote Control Questions And Answers

1⟩ Tell me what are the pre-requisites to run Selenium RC tests with Junit?

The pre-requisites to run Selenium RC tests with Junit:

1) Jre 1.5 or better version needs to be installed

2) /jre/bin folder must be added in environment variable "path"

3) Junit folder path must be added to path or build path in eclipse

4) Selenium Java Client drivers needs to be added to the path for execution

 173 views

4⟩ How to configure Selenium RC with eclipse to run Junit Tests?

1) Download eclipse.

2) Open eclipse -> Workspace Launcher window will open

3) Create a workspace by giving meaningful name

3) Click on Workbench

4) Create a project of type java

5) Create a package under src folder of the package

6) Add Junit to the build path

7) Add selenium rc java client driver to the build path

8) Now drag and drop your test script (.which is exported from Selenium IDE) to the package created

 152 views

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

selenium.setSpeed

1. takes a single argument in string format

ex: selenium.setSpeed("2000") - will wait for 2 seconds

2. Runs each command in after setSpeed delay by the number of milliseconds mentioned in setSpeed.

thread.sleep

1. takes a single argument in integer format

ex: thread.sleep(2000) - will wait for 2 seconds

2. Waits for only once at the command given at sleep.

 210 views

6⟩ Why do you use assert and verify statements in Selenium RC without referring to selenium?

SeleneseTestCase is the class which is having

1. assertTrue

2. verifyTrue

3. assertEquals

4. verifyEquals

We use SeleneseTestCase class to extend the selenium test class file.

For Ex: the test class is declared as follows

public class BookFlightSel1 extends SeleneseTestCase

In the above example SeleneseTestCase is the base class and BookFlightSel1 is the derived class. So, we can directly call and use the parent class methods verify and assert without instantiating the class in BookFlightSel1 class.

 165 views

7⟩ Which are the annotations generated with JUnit 4 tests in Selenium IDE?

The annotations generated with JUnit 4 tests in Selenium are:

1. @Before public void method() - Will perform the method() before each test. This method can prepare the test

2. @Test public void method() - Annotation @Test identifies that this method is a test method.environment, e.g. read input data, initialize the class)

3. @After public void method() - Test method must start with test@Before - this annotation is used for executing a method before.

 143 views

8⟩ What are the challenges with Selenium RC test suites when running in JUnit?

The challenges with Selenium RC test suites when running in JUnit

1. Each test case of Selenium RC test will invoke the browser and closes after playing back

2. All the Test cases cannot run on a single browser session

3. If there is any dependency between the test cases, it is very difficult to execute

4. Running the test suites in junit will be helpful for only independent test cases.

Note: The dependent test case related issues can be addressed by using TestNG with junit

 160 views

9⟩ What are the basic annotations used to run TestNG tests in Selenium?

The basic annotations used to run TestNG tests in Selenium RC:

1. @BeforeClass: The annotated method with @BeforeClass will be run before the first test method in the current class is invoked.

2. @AfterClass: The annotated method with @AfterClass will be run after all the test methods in the current class have been run.

3. @BeforeMethod: The annotated method with @BeforeMethod will be run before each test method.

4. @AfterMethod: The annotated method with @AfterMethod will be run after each test method.

5. @Test: Marks a class or a method @Test with as part of the test.

 145 views

12⟩ How to execute the test cases in an XML format using TestNG in Selenium?

If you want to execute a java file MercTestNgSuite.java which is there in the package com.src.testng. You can use the belowmentioned code in a xml file. And the test can be run by right clicking the XML and running as TestNG Suite

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">

<suite thread-count="5" skipfailedinvocationCounts="false" verbose="1" name="MercPrj" junit="false" parallel="false" annotations="JDK">

<test verbose="2" name="com.src.testng.MercTestNgSuite" junit="false" annotations="JDK">

<classes>

<class name="com.src.testng.MercTestNgSuite"/>

</classes>

</test>

</suite> ??

 153 views

13⟩ How to incude or exclude the selenium rc test cases using xml in TestNG?

Including or excluding of selenium rc test cases using xml in TestNG can be done using the keywords include or exlude

For including a test case we need to use <include name="method name"/> under the class whichever the method you want to include

For excluding a test case we need to use <exclude name="method name"/> under the class whichever the method you want to include

For example if you have a class MercTestNgSuite in package com.src.testng want to include the methods like:

1. testLogin1

2. testFindFlights

3. testSelectFlights

4. testFillUserDetails

5. testVerifyFlightConf

and exclude

6. testLogout

the xml can be written as mentioned below.

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">

<suite thread-count="5" skipfailedinvocationCounts="false" verbose="1" name="MercPrj" junit="false" parallel="false" annotations="JDK">

<test verbose="2" name="com.src.testng.MercTestNgSuite" junit="false" annotations="JDK">

<classes>

<class name="com.src.testng.MercTestNgSuite"/>

<methods>

<include name="testLogin1"/>

<include name="testFindFlights"/>

<include name="testSelectFlights"/>

<include name="testFillUserDetails"/>

<include name="testVerifyFlightConf"/>

<exclude name="testLogout"/>

</methods>

</classes>

</test>

 158 views

14⟩ How to execute the selenium test suite with testNG in XML?

Assume that you have two classes which are having suite of test cases with the below mentioned methods.

class1 or suite 1: the class by name MercTestNgSuite in the package com.src.testng with the methods

1. testLogin1

2. testFindFlights

3. testSelectFlights

4. testFillUserDetails

class1 or suite 2:the class by name MercTestNgSuite2 in the package com.src.testng with the methods

1. testLogin1

2. testFindFlights

3. testSelectFlights

4. testFillUserDetails

5. testVerifyFlightConf

6. testLogout

The two class suites can be executed as mentioned

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">

<suite thread-count="5" skipfailedinvocationCounts="false" verbose="1" name="MercPrj" junit="false" parallel="false" annotations="JDK">

<test verbose="2" name="com.src.testng.*" junit="false" annotations="JDK">

<classes>

<class name="com.src.testng.MercTestNgSuite"/>

<methods>

<include name="testLogin1"/>

<include name="testFindFlights"/>

<include name="testSelectFlights"/>

<include name="testFillUserDetails"/>

</methods>

<class name="com.src.testng.MercTestNgSuite2"/>

<methods>

<include name="testLogin1"/>

<include name="testFindFlights"/>

<include name="testSelectFlights"/>

<include name="testFillUserDetails"/>

<include name="testVerifyFlightConf"/>

<include name="testLogout"/>

</methods>

</classes>

</test>

</suite>

 167 views

16⟩ What are the limitations of selenium RC?

The limitations of selenium RC are:

1) Switching between the multiple instances of the same browser is not possible

2) Switching between the multiple instances of the different browsers is not possible

3) Browser navigation, like back and forward button emulations is not possible

4) Limited features in terms of drag and drop of objects

5) To work with Ajax based UI elements there are very limited features are there with Selenium RC

To overcome the above limitations we use selenium web driver or google web driver

 161 views

17⟩ How to start selenium rc server with user extensions?

The command used is

java -jar selenium-server.jar -userExtensions user-extensions.js

Note: In this case, the java script file user-extensions.js file name should always fixed. If the name or extension is changed the selenium rc server will not start.

 182 views