Selenium Forum: Functional And Regression Testing Tool.
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Search
Display results as :
Advanced Search
Latest topics
AEM Training | Free Online DemoWed Apr 21, 2021 5:45 pmazharuddin
c# PageFactory - issue initializing elementsFri Nov 01, 2019 8:40 pmthegoatboy
Selenium making automatic connection to random urlsMon Jul 08, 2019 12:58 pmrepairtechsolutions1
How can we design the custom framework in Selenium RCMon Jun 24, 2019 2:26 pmrandybonnettes
What are the new features in Selenium 3.0Tue Jun 18, 2019 5:37 pmpappyvicky
What are you using Selenium for? Fri Apr 12, 2019 3:52 amzhl
LIMITATIONS OF SELENIUMWed Apr 10, 2019 11:23 amswara
Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Go down
avatar
ramaswamy
Active particpant
Active particpant
Posts : 22
Join date : 2011-11-28

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

Tue Nov 29, 2011 10:05 am
Hi All

please give one example data driven data program in java language.
avatar
susmitha
Active particpant
Active particpant
Posts : 15
Join date : 2011-10-21

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

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();

}
}
avatar
ramaswamy
Active particpant
Active particpant
Posts : 22
Join date : 2011-11-28

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

Tue Nov 29, 2011 5:25 pm
thank you so much susmitha
avatar
sachin123
Posts : 7
Join date : 2011-11-29

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

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?
avatar
lalkota
Active particpant
Active particpant
Posts : 21
Join date : 2011-06-02

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

Tue Dec 06, 2011 5:29 pm
Message reputation : 0% (1 vote)
Hello,

Visit this link

http://online-selenium-trainings.webs.com
http://seleniumtraining.in
http://seleniumtraining.blogspot.com/
avatar
ramaswamy
Active particpant
Active particpant
Posts : 22
Join date : 2011-11-28

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

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...........
Sponsored content

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

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