Selenium Training

Selenium Training in Java

Blog

view:  full / summary

Selenium IDE parameterization

Posted by [email protected] on September 19, 2011 at 8:15 AM Comments comments (14)

Parameterization of Selenium IDE using XML

Download the flowcontrol extension for IDE.  (“Download” is a bit of a misnomer here, as the download link takes one to an HTML page. 

Simply copy/paste only the JavaScript contents of that page into a file named goto_sel_ide.js.) Download the 1.1 version of the includeCommand4IDE extension.  (The just-released 1.2 version appears to have a serious bug.)

Download the most recent version (0.2) of the datadriven.js extension. Install these 3 extensions in IDE via the Selenium Core extensions field (accessible via Options=>Options=>General).

They must be specified in the order above!!! Re-start IDE so that all 3 extensions will get read in. Create an .xml file:

check the attached zip file.

linkText and title are variable names of my choosing.You can use any names you want, and also any number of variables you want. Thecritical thing is that each <test> container must contain allthe data–input and output–for a single test case.

View your .xml file in the browser to ensure that it does not contain any errors (only necessary if you did not use an XML editor to create the file). Utilize your .xml file via creating an HTML test case


download attched code

http://online-selenium-trainings.webs.com/selenium-extension.zip


Selenium work flow

Posted by [email protected] on July 21, 2011 at 2:54 AM Comments comments (3)


Selenium Interview Questions

Posted by [email protected] on July 1, 2011 at 9:01 AM Comments comments (31)

1. How do you start Selenium RC?

Ans:

simple way  to start selenum rc is

 java -jar selenium-server.jar

 to run a suite of Selenese scripts in a browser

java -jar selenium-server.jar -htmlSuite

2. How do you connect Data base from selenium

Ans:

Connecting to database is lanuage dependent. if we are using Java

A Connection object represents aconnection with a database. When we connect to a database by using connection method, we create a Connection Object, which represents theconnection to the database. An application may have one or more than one connections with a single database or many connections with different databases.

We can use the Connection object for the following things:

1). It creates the Statement, PreparedStatement and CallableStatement objects for executing the SQL statements.

2). It helps us to Commit or roll back a jdbc transactionn.

3). If you want to know about the database or data source to which you are connected then the Connection object gathers information about the database or data source by the use of DatabaseMetaData.

4). It helps us to close the data source. The Connection.isClosed() method returns true only if the Connection.close() has been called. This method is used to close all the connection.

Firstly we need to to establish the connection with the database. This is done by using the method DriverManager.getConnection(). This method takes a string containing a URL. The DriverManager class, attempts to locate a driver that can connect to the database represented by the string URL. Whenever the getConnection() method is called the DriverManager class checks the list of all registered Driver classes that can connect to the database specified in the URL.

Syntax:

String url = "jdbc: odbc: makeConnection";

Connection con = DriverManager.getConnection(url, "userID", "password");


3. How do you handle Ajax controls using selenium?

Eg. By typing in search engine how do you capture the auto suggestion

4. How do you select the 2nd item in a List box or drop down.

Ans:

selenium.select(selectLocator, optionLocator)

selectLocator – a locator for the select element

optionLocator – a locator for the option element


5. How do you identify an object using selenium?

Ans:

isElementPresent(String locator)
isElementPresent takes a locator as the argument and if found returns a boolean value of True.

6. How do you capture an element loading after the page load?

Ans:

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

}

}

7. Brief about your framework

8. What is the difference between assert and Verify Commands?

Ans:

There are two mechanisms for validating elements that are available on the application under test. The first is assert: this allows the test to check if the element is on the page. If it is not available, then the test will stop on the step that failed. The second is verify: this also allows the test to check whether the element is on the page, but if it isn't, then the test will carry on executing.

9. Explain about your reporting method

10.How do you verify an object presented in multiple pages.

Ans:

Check on each page

assertTrue(selenium.isElementPresent(locator));

11.What are the locators available in Selenium?

Ans:

  1. ID
  2. Name
  3. Filters
  4. DOM
  5. CSS
  6. Xpath

12.What is the difference between single and double slash in Xpath

Ans:

 /

  1.  start selection from the document node
  2. allows you to create 'absolute' path expressions
  3. e.g. “/html/body/p” matches all the paragraph elements

 //

  1.  start selection matching anywhere in the docume
  2. allows you to create 'relative' path expressions
  3. e.g. “//p” matches all the paragraph elements


13.Brief about Selenium Client.

14.Did you write any User Extensions.

User extensions are stored in a separate file that we will tell Selenium IDE or Selenium RC to use. Inside there the new function will be written in JavaScript.

Because Selenium's core is developed in JavaScript, creating an extension follows the standard rules for prototypal languages. To create an extension, we create a function  in the following design pattern.

Selenium.prototype.doFunctionName = function(){

.

}

The "do" in front of the function name tells Selenium that this function can be called  as a command for a step instead of an internal or private function.

 

 

15.What are all things can not be done through selenium IDE

Ans:

  1. Easy record and playback.
  2. Intelligent field selection will use IDs, names, or XPath as needed.
  3. Autocomplete for all common Selenium commands.
  4. Walk through tests.
  5. Debug and set breakpoints.
  6. Save tests as HTML, Ruby scripts, or any other format.
  7. Support for Selenium user-extensions.js file.
  8. Option to automatically assert the title of every page.


Advantages: Selenium IDE is the only flavor of Selenium, which allows you to record user action on browser window. It can also record user actions in most of the popular languages like Java, C#, Perl, Ruby etc. This eliminates the need of learning new vendor scripting language. For executing scripts created in these languages, you will need to use Selenium Remote Control. If you do not want to use Remote Control than you will need to create your test scripts in HTML format.

Disadvantages: Biggest drawback of Selenium IDE is its limitation in terms of browser support. Though Selenium scripts can be used for most of the browser and operating system, Scripts written using Selenium IDE can be used for only Firefox browser if it is not used with Selenium RC or Selenium Core.

16.Brief about Selenium Grid.

Ans:

Selenium Grid is a tool that dramatically speeds up functional testing of web-apps by leveraging your existing computing infrastructure. It allows you to easily run multiple tests in parallel, on multiple machines, in an heterogeneous enviroment. 

Based on the excellent Selenium web testing tool, Selenium Grid allows you to run multiple instances of Selenium Remote Control in parallel. Even better, it makes all these Selenium Remote Controls appear as a single one, so your tests do not have to worry about the actual infrastructure. Selenium Grid cuts down on the time required to run a Selenium test suite to a fraction of the time that a single instance of Selenium instance would take to run.

17.Is it possible to start the Remote engine more than once in an instance.

18. How to use selenium for performance testing

19. How to start the selenium server from your language class?

Ans:

try {

      seleniumServer = new SeleniumServer();

      seleniumServer.start();

} catch (Exception e) {

      e.printStackTrace();

}

20. Is it possible to handle multiple pop ups in selenium?

22. Give the benefits of SQL Stored procedure in selenium?

23.What are the difficulties or challenge you faced in selenium?

24. How do you check a single test method in multiple browser?

25. What is the annotation you use to connect the Spread sheet in Junit.

26.Brief about Junit annotations.

27.How can we speed up the selenium script execution?

28.If the default port of selenium is busy then which port you use?

29.Explain types of SQL joins.

30.How do you handle the secured connection error in HTTPS?

31.How do you compare two strings or values are same.



Rss_feed

Upcoming Events

No upcoming events

Testimonials

  • "All I can say is that it was an excellent training session. Ramesh dealt each class with a lot of enthusiasm and had a clear motive on what he was about to deliver. The course c..."
    Pramod
    Test Lead
  • "Hi all, I don't have much word to say regarding this selenium training classes[ taught by Ramesh sir], but one thing i would like to share to all of you, way of teaching was su..."
    sushanth
  • "Hi All,I would like to share my views on Training conducted by Ramesh Sir w.r.t Selenium.The Trainings were exhaustive and very Explanative and very informative.He has a lot of..."
    Ramesh Sir's Tutorials on Selenium

Subscribe To Our Site