Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
» Selenium WebDriver Integration
Tue Nov 21, 2017 1:06 pm by azharuddin

» 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

Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

urgent- please give me one example of data driven data program in selenium rc using java language

View previous topic View next topic Go down

urgent- please give me one example of data driven data program in selenium rc using java language

Post by ramaswamy on Tue Nov 29, 2011 10:05 am

Hi All

please give one example data driven data program in java language.

ramaswamy
Active particpant
Active particpant

Posts : 22
Join date : 2011-11-28

Back to top Go down

Re: urgent- please give me one example of data driven data program in selenium rc using java language

Post by susmitha on Tue Nov 29, 2011 12:36 pm

import java.io.FileInputStream;
import java.io.FileOutputStream;

import jxl.Sheet;
import jxl.Workbook;
import jxl.write.Label;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;

import com.thoughtworks.selenium.*;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.server.*;

public class DataDrivenTestingUsingJunit {
private Selenium selenium;
private SeleniumServer seleniumserver;

@Before
public void setUp() throws Exception {
RemoteControlConfiguration rc = new RemoteControlConfiguration();
seleniumserver = new SeleniumServer(rc);
selenium = new DefaultSelenium("localhost", 4444, "*firefox", "http://");
seleniumserver.start();
selenium.start();
selenium.setSpeed("3000");
}

@Test
public void testImportexport1() throws Exception {

// Read data from excel sheet
FileInputStream fis = new FileInputStream(
"src/resources/GmailTestData.xls");
Workbook w = Workbook.getWorkbook(fis);
Sheet s = w.getSheet(0);
String a[][] = new String[s.getRows()][s.getColumns()];
// Write the input data into another excel file
FileOutputStream fos = new FileOutputStream(
"src/resources/GmailTestResult.xls"); //create a folder resources in ecllipse src folder and initialize the GmailTestResult.xls which data you want to test test.xls file
// Be sure that the extension of file should be .xls not .xlsx

WritableWorkbook writableBook = Workbook.createWorkbook(fos);
WritableSheet destinationSheet = writableBook.createSheet("loginresult1", 0);

selenium.open("http://www.gmail.com");
selenium.windowMaximize();

System.out.println("s.getRows() = " + s.getRows());

for (int i = 0; i < s.getRows(); i++) {
System.out.println("s.getColumns = " + s.getColumns());
for (int j = 0; j < s.getColumns(); j++) {
a[i][j] = s.getCell(j, i).getContents();
Label l = new Label(j, i, a[i][j]);
Label l1 = new Label(2, 0, "Result");
destinationSheet.addCell(l);
destinationSheet.addCell(l1);
}
}

for (int i = 1; i < s.getRows(); i++)
{
selenium.type("Email", s.getCell(0, i).getContents());
selenium.type("Passwd", s.getCell(1, i).getContents());
selenium.click("signIn");
selenium.waitForPageToLoad("30000");

boolean aa = selenium
.isTextPresent("The username or password you entered is incorrect. ?");
System.out.println("the value of aa is::" + aa);
if (aa)
{

Label l3 = new Label(2, i, "fail");

destinationSheet.addCell(l3);
System.out.println("Login Failure");
Thread.sleep(10000);

}
else
{
Label l2 = new Label(2, i, "pass");
destinationSheet.addCell(l2);
String str = selenium.isElementPresent("link=Sent Mail") == true ? "true"
: "false";
selenium.waitForCondition(selenium
.isElementPresent("link=Sent Mail") == true ? "true"
: "false", "60000");
selenium.click("link=Sent Mail");
selenium.click("gbgs4");
selenium.click("gb_71");
http://selenium.waitForPageToLoad("30000");
Thread.sleep(10000);
}
}
writableBook.write();
writableBook.close();
}

@After
public void tearDown() throws Exception {
selenium.stop();
seleniumserver.stop();

}
}

susmitha
Active particpant
Active particpant

Posts : 15
Join date : 2011-10-21

Back to top Go down

Re: urgent- please give me one example of data driven data program in selenium rc using java language

Post by ramaswamy on Tue Nov 29, 2011 5:25 pm

thank you so much susmitha

ramaswamy
Active particpant
Active particpant

Posts : 22
Join date : 2011-11-28

Back to top Go down

Re: urgent- please give me one example of data driven data program in selenium rc using java language

Post by sachin123 on Sat Dec 03, 2011 2:27 am

above program is not executed susmitha.

only firefox broser opened and terminated the program what i do now?

sachin123

Posts : 7
Join date : 2011-11-29

Back to top Go down

Re: urgent- please give me one example of data driven data program in selenium rc using java language

Post by ramaswamy on Tue Dec 13, 2011 4:40 pm

am using using Selenium RC with JUnit and testng jar files are

junit-4.8.2.jar
jxl.jar
selenium-grid-tools-1.0.8.jar
selenium-java-client-driver.jar
selenium-server.jar
testng-5.14.jar


but, which jar files are using in webdriver please give me solution...........

ramaswamy
Active particpant
Active particpant

Posts : 22
Join date : 2011-11-28

Back to top Go down

Re: urgent- please give me one example of data driven data program in selenium rc using java language

Post by Sponsored content


Sponsored content


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