Paul Singleton
Selenium RC
2 Answer(s)      4 years and 2 months ago
Posted in : Java Beginners

View Answers

April 3, 2009 at 2:35 AM


sorry should be a little more clear, after the classes have been created I want to add them in the the same test so it creates a UID for one section and then logs in on a different part of the site to confirm the account is created.

March 25, 2013 at 1:55 PM


Below info gives a good begining
OOPS concepts

Object-An object is a software bundle of related state(Color,Height etc) and behavior(Selection).An object stores its state in fields (variables) and exposes its behavior through methods (functions).Ex-Vehicle.

Class-Class is ma collection of objects.

Inheritance-Different kinds of objects often have a certain amount in common with each other. Cars,Bikes etc for example, all share the characteristics of vehicles (speed, gear).
class Student{
 int rollno;
 String name;

 void insertRecord(int r, String n){  //method
  rollno=r;
  name=n;
 }

 void displayInformation(){System.out.println(rollno+" "+name);}//method

 public static void main(String args[]){
  Student s1=new Student();
  Student s2=new Student();

  s1.insertRecord(111,"Karan");
  s2.insertRecord(222,"Aryan");

  s1.displayInformation();
  s2.displayInformation();

 }
}


The syntax for creating a subclass is simple. At the beginning of your class declaration, use the extends keyword, followed by the name of the class to inherit from:

class car extends vehicle {

    }
 Interface-interface is a group of related methods without definition i.e code in them. Class which implements the interface defines the methods.     Ex- Buttons on a Remote act as Interface betweenTV and the viewer. A  vehicles behavior, if specified as an interface, might appear as  follows:interface Vehicle {
    void changeGear(int newValue);
    void speedUp(int increment);
}
To implement this interface, the name of your class would change (to a particular brand of vehicle, for example, such as car), and you'd use the implements keyword in the class declaration:
class car implements vehicle {
    public void changeGear(int newValue){     System.out.println("Change gear");}    public void speedUp(int increment){
System.out.println("Change speed");}}
Package-A package is a namespace that organizes a set of related classes and interfaces. Conceptually you can think of packages as being similar to different folders on your computer. 
 Selenium Server

Selenium Server receives Selenium commands from your test program, interprets them, and reports back to your program the results of running those tests.



Installing Selenium Server

Install Java SE Development Kit 7u15 and then Eclipse for Java EE Developers(Juno).

The Selenium RC server is simply a Java jar file (selenium-server-standalone-<version-number>.jar), which doesn�t require any special installation. Just downloading the zip file and extracting the server in the desired directory is sufficient.

Running Selenium Server

Before starting any tests you must start the server. Go to the directory where Selenium RC�s server is located and run the following from a command-line console.

java -jar selenium-server-standalone-<version-number>.jar

This can be simplified by creating a batch file(.bat) containing the command above. Then make a shortcut to that executable on your desktop and simply double-click the icon to start the server.For the server to run you�ll need Java installed.

Using the Java Client Driver

ââ?? Download Selenium java client driver zip from the SeleniumHQ downloads page.
 ââ?? Extract selenium-java-<version-number>.jar file
 ââ?? Open Java IDE i.e Eclipse
 ââ?? Create a java project using File-New-Java Project
ââ?? Then create a package using File-New-Package.
ââ?? Then create TestNG Class from File-New-Other-TestNG-TestNG Class.
 ââ?? Add the selenium-java-<version-number>.jar files to your project as references.Right click on Project and select Build Path-Configure build path. 



Select Libraries tab and click on Add external jars.-

1)Add Java client jars

2)Add TestNG jar

Xpath-Install Firebug and xpath checker addons in Firefox. Open Firebug from Tools-Web developer-Firebug-Open Firebug.In xpath checker write xpath in the format //input[@id='xxx'] by using the HTML tag displayed in Firebug. Then the object will be displayed in XPath Checker window.

Sample TestNG code

package sampleTest;

import org.testng.annotations.Test;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.AfterClass;

import com.thoughtworks.selenium.DefaultSelenium;
import com.thoughtworks.selenium.Selenium;

public class NewTest {

 protected Selenium sel;

  @Test
  public void start() {


  }
  @BeforeClass
  public void startServer() {
   sel = new DefaultSelenium("localhost",4444,"*firefox","http://www.google.com");
   sel.start();
   try
   {
    sel.open("/");
    sel.waitForPageToLoad("30000");

   }
   catch(Exception e)
   {

   }
  }

  @AfterClass
  public void stopserver() {

   sel.close();
   sel.stop();
  }

}

Learning the API
Starting the Browser

setUp("http://www.google.com/", "*firefox");-This starts a Browser instance.The parameters required when creating the browser instance are:host-Normally localhost is passed. This is optional parameter.port-This is optional parameterbrowserurlReporting ResultsJava has two commonly used test frameworks, JUnit and TestNG. .NET also has its own, NUnit.









Related Pages:
Selenium RC - Java Beginners
Selenium RC  Hi, How do split the classes into smaller files and include them in selenium RC, example I want to have a seperate class for log in, a seperate one for user creations ect.  sorry should be a little more
selenium rc java client driver - WebSevices
selenium rc java client driver  how to implement getcookies functions in selnium rc??? i m using getcookies function in selenium rc java client driver. but its given some error. pls tell me whether i have 2 write code
CubicTest
provided are a Selenium RC test runner, a Selenium Core exporter and a Watir exporter. A recorder based on Selenium RC is also provided for recording directly...; CubicTest is a visual Eclipse plug-in for writing Selenium and Watir tests
Eclipse Plugin-Rich Client Applications
Eclipse Plugin-Rich Client Applications       OpenTime/RC OpenTime/RC is an open-source and standards compliant solution to time and expense data collection
Multiple url handling
Multiple url handling  I want to pick URLs from excel/CSV file and assign those urls to String variable and use that string variable to open the specified url from browser. I have written code to open browser using selenium
Sunstar
Sunstar  Hi I am new to java and I'm trying to work on the program add item to shopping cart I would appreciate if you could help me out. I need to add items to a shopping cart in a web application and I'm using selenium
Sql querry not working
of slabs. CBID is cutblock ID. My code: ResultSet rc=st.executeQuery("select
can modify this application connection with database
java.awt.event.*; public class RC extends JFrame implements ActionListener...("$##.##"); public RC(){ setLayout(null); lab=new JLabel("Welcome...[]args){ new RC(); } }   
Error - Development process
= "=(RC[-27]-0)/3600" Range("AC2").Select Selection.AutoFill Destination...("AD2").FormulaR1C1 = "=IF(RC[-21]>RC[-22],0,SQRT(RC[-22]^2-RC[-21]^2...:=xlFillDefault Range("AE1").Value = "EL(RAD)" Range("AE2").FormulaR1C1 = "=(RC
About National Museum of Delhi India
, the then Governor-General of India, Shri R.C. Rajagopalachari inaugurated the National
how to convert java Applet to Jave Frame
*; public class RC extends Applet implements ActionListener{ TextField... java.text.*; import java.awt.event.*; public class RC extends JFrame implements... DecimalFormat("$##.##"); public RC(){ setLayout(null); lab=new JLabel
Introduction to RCFaces
-pattern>/rc-content/*</url-pattern> </servlet-mapping> </web
FreeBSD 6.1-RC1 has been released now
architecture. This RC is late in coming due to many more bugs being fixed, as well
how to add database in Java Applet
java.util.*; import java.text.*; import java.awt.event.*; public class RC extends
displaying List of records from database in a jsp using ajax
var="rc" items="${listKey}"> <tr bgcolor="grey">
Installing Java
for all the GUI based applications. rc\ directory : This directory contains
Installing Java
for all the GUI based applications. rc\ directory : This directory contains
Frugalware 0.4rc2-i686 released
the changes in the pre/rc releases, the most important changes
problem with executing JSF file(Build failed)
Contents </servlet-name> <url-pattern>/rc
NetBeans IDE
Introduction [Notes written for NetBeans 5.0 rc 2 (better than the official

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.