Display results as :

Rechercher Advanced Search

Latest topics
» how to connect DB in selenium webriver
Fri Oct 06, 2017 4:09 pm by anbarasi

» How find any text in browser screen and click on it?
Thu Oct 05, 2017 2:02 pm by sandeepkommineni

» Selenium Webdriver
Tue Oct 03, 2017 1:35 pm by PiyushBiswas

» GRID setup tutorial.
Wed Sep 27, 2017 4:29 pm by johnyapp

» Drag & Drop Between Windows Using Selenium Driver
Wed Sep 27, 2017 2:10 pm by 26rondel

» Check if window is closed / verify input
Sat Sep 23, 2017 10:21 pm by brainstir

» How to work on pages with AJAX in selenium?
Mon Sep 18, 2017 6:08 pm by azharuddin

» pause test until user press a key like F2
Wed Aug 09, 2017 11:10 pm by djnforce

» Selecting the input for auto populating element
Sat Jul 29, 2017 7:53 pm by kdabbara


Parameterise you login page using java.

View previous topic View next topic Go down

Parameterise you login page using java.

Post by Adviser on Mon Aug 17, 2009 12:08 pm


This is a sample code which parameterise you application using selenium rc in java. The idea is to use array/list to store diffrenet username and password.

Snippet of code are as follows:

import com.thoughtworks.selenium.*;

public class parameterized
private Selenium browser;

public static void main(String []args)
String arr[][] = new String[5][2];
arr[0][0]= "bert"; arr[0][1]="llp4";
arr[1][0]= "regular"; arr[1][1]="llp4";
arr[2][0]= "copyonly"; arr[2][1]="llp4";
arr[3][0]= "doert"; arr[3][1]="llp4";
arr[4][0]= "inter"; arr[4][1]="llp4";

parameterized obj = new parameterized();

public void setUp()
browser = new DefaultSelenium("localhost",4444, "*chrome", "");

public void login_parameterize(String[][] arr )
int row = arr.length;
int col = arr[0].length;

for(int i=0;i

for(int j=0;j

browser.type("username", arr[i][j]);
browser.type("password", arr[i][j+1]);"LoginButton");




Note: Change url and ID according to your application.

Posts : 379
Join date : 2009-07-30
Location : India

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

Permissions in this forum:
You cannot reply to topics in this forum