Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
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 lalkota on Tue Dec 06, 2011 5:29 pm

Hello,

Visit this link

http://online-selenium-trainings.webs.com
http://seleniumtraining.in
http://seleniumtraining.blogspot.com/

lalkota
Active particpant
Active particpant

Posts : 21
Join date : 2011-06-02

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