Selenium RC

Ads

 
 

Share on Google+Share on Google+

Paul Singleton
Selenium RC
2 Answer(s)      8 years ago
Posted in : Java Beginners
Ads
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.

Ads









Related Tutorials/Questions & Answers:
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
Advertisements
Selenium-HP-Alm framework
Selenium-HP-Alm framework  selenium-hp-alm framework
Version of com.assertthat>selenium-shutterbug dependency
List of Version of com.assertthat>selenium-shutterbug dependency
Version of com.deque>axe-selenium dependency
List of Version of com.deque>axe-selenium dependency
Version of com.pojosontheweb>selenium-utils dependency
List of Version of com.pojosontheweb>selenium-utils dependency
Version of com.aimmac23>selenium-video-node dependency
List of Version of com.aimmac23>selenium-video-node dependency
Version of com.applitools>eyes-selenium-java dependency
List of Version of com.applitools>eyes-selenium-java dependency
Version of com.applitools>eyes-selenium-java-ab2_39 dependency
List of Version of com.applitools>eyes-selenium-java-ab2_39 dependency
Version of com.applitools>eyes-selenium-java-jersey1_17-sf2_51_0 dependency
List of Version of com.applitools>eyes-selenium-java-jersey1_17-sf2_51_0 dependency
Version of com.applitools>eyes-selenium-java-jersey1_17-sf2_53_1 dependency
List of Version of com.applitools>eyes-selenium-java-jersey1_17-sf2_53_1 dependency
Version of com.applitools>eyes-selenium-java-jersey1x dependency
List of Version of com.applitools>eyes-selenium-java-jersey1x dependency
Version of com.applitools>eyes-selenium-java-jersey1x-sf2_45 dependency
List of Version of com.applitools>eyes-selenium-java-jersey1x-sf2_45 dependency
Version of com.applitools>eyes-selenium-java-jersey1x-sf2_48_2 dependency
List of Version of com.applitools>eyes-selenium-java-jersey1x-sf2_48_2 dependency
Version of com.applitools>eyes-selenium-java-jersey2x dependency
List of Version of com.applitools>eyes-selenium-java-jersey2x dependency
Maven Dependency selenium-shutterbug >> 0.1
You should include the dependency code given in this page to add Maven Dependency of com.assertthat >> selenium-shutterbug version0.1 in your project
Maven Dependency selenium-shutterbug >> 0.2
You should include the dependency code given in this page to add Maven Dependency of com.assertthat >> selenium-shutterbug version0.2 in your project
Maven Dependency selenium-shutterbug >> 0.3
You should include the dependency code given in this page to add Maven Dependency of com.assertthat >> selenium-shutterbug version0.3 in your project
Maven Dependency selenium-shutterbug >> 0.4
You should include the dependency code given in this page to add Maven Dependency of com.assertthat >> selenium-shutterbug version0.4 in your project
Maven Dependency selenium-shutterbug >> 0.5
You should include the dependency code given in this page to add Maven Dependency of com.assertthat >> selenium-shutterbug version0.5 in your project
Maven Dependency selenium-shutterbug >> 0.6
You should include the dependency code given in this page to add Maven Dependency of com.assertthat >> selenium-shutterbug version0.6 in your project
Maven Dependency selenium-shutterbug >> 0.6.1
You should include the dependency code given in this page to add Maven Dependency of com.assertthat >> selenium-shutterbug version0.6.1 in your project
Maven Dependency axe-selenium >> 2.0
You should include the dependency code given in this page to add Maven Dependency of com.deque >> axe-selenium version2.0 in your project
Maven Dependency axe-selenium >> 1.0
You should include the dependency code given in this page to add Maven Dependency of com.deque >> axe-selenium version1.0 in your project
Maven Dependency axe-selenium >> 1.1
You should include the dependency code given in this page to add Maven Dependency of com.deque >> axe-selenium version1.1 in your project
Maven Dependency selenium-utils >> 1.0
You should include the dependency code given in this page to add Maven Dependency of com.pojosontheweb >> selenium-utils version1.0 in your project
Maven Dependency selenium-utils >> 1.0.1
You should include the dependency code given in this page to add Maven Dependency of com.pojosontheweb >> selenium-utils version1.0.1 in your project
Maven Dependency selenium-utils >> 1.0.2
You should include the dependency code given in this page to add Maven Dependency of com.pojosontheweb >> selenium-utils version1.0.2 in your project
Maven Dependency selenium-utils >> 1.0.3
You should include the dependency code given in this page to add Maven Dependency of com.pojosontheweb >> selenium-utils version1.0.3 in your project
Maven Dependency selenium-utils >> 1.0.4
You should include the dependency code given in this page to add Maven Dependency of com.pojosontheweb >> selenium-utils version1.0.4 in your project
Maven Dependency selenium-utils >> 1.0.5
You should include the dependency code given in this page to add Maven Dependency of com.pojosontheweb >> selenium-utils version1.0.5 in your project