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


how to get data dynamically from Notepad file

View previous topic View next topic Go down

how to get data dynamically from Notepad file

Post by tweety on Tue Jul 10, 2012 7:44 pm

Hi All,

I have two variables declared in notepad with multiple values.How can I get those values in testscript of Selenium and compare it and add those values only if they are equal.

Can anyone please suggest me on this.




Posts : 1
Join date : 2012-07-10

Back to top Go down

Re: how to get data dynamically from Notepad file

Post by ashish_gangwar on Wed Aug 08, 2012 1:57 pm

1. You can use Java Script. Either Embedded js in IDE directly or write an extention.
2. Write code in Java and call it through FIT which can be called from IDE


Posts : 5
Join date : 2012-08-06
Age : 40
Location : Noida

Back to top Go down

Re: how to get data dynamically from Notepad file

Post by sanjeetravi on Thu Aug 09, 2012 12:24 pm

import com.thoughtworks.selenium.*;

import org.testng.annotations.*;

import static org.testng.Assert.*;

import java.util.regex.Pattern;

public class Reserve_Type_Add extends SeleneseTestNgHelper {

public void setUp() throws Exception {
selenium = new DefaultSelenium("localhost", 4444, "*chrome", "http://localhost:7001/");
@Test public void testAbc() throws Exception {

try {

FileInputStream fstream = new FileInputStream(
"C:\\Documents and Settings\\mann\\Desktop\\Add_New_Reserve_Type.txt");
// Get the object of DataInputStream
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String strLine;
// Read File Line By Line
while ((strLine = br.readLine()) != null)
String strline1[] = strLine.split(",");"/SimonWeb/login.html");"id=submit");

for (int second = 0;; second++) {
if (second >= 60) fail("timeout");
try { if (selenium.isTextPresent("Code")) break; } catch (Exception e) {}

for (int second = 0;; second++) {
if (second >= 60) fail("timeout");
try { if (selenium.isTextPresent("Formula Description")) break; } catch (Exception e) {}

selenium.type("id=addEditForm:reserveCode", strline1[0]);"id=addEditForm:reserveType", "label=Computation Logic");
selenium.type("id=addEditForm:reserveTypeDesc", strline1[1]);
selenium.type("id=addEditForm:reserveValue1", strline1[2]);
selenium.type("id=addEditForm:reserveValue2", strline1[3]);
selenium.type("id=addEditForm:reserveValue3", strline1[4]);
selenium.type("id=addEditForm:reserveValue4", strline1[5]);"id=addEditForm:j_idt336");"id=addEditForm:popUpButton");
for (int second = 0;; second++) {
if (second >= 60) fail("timeout");
try { if (selenium.isTextPresent("You have successfully Added the Reserve Type.")) break; } catch (Exception e) {}

catch (Exception e) {

public void tearDown() throws Exception {

and the file contain data like a,b
Regular Participant
Regular Participant

Posts : 27
Join date : 2012-07-10
Age : 27
Location : Delhi

Back to top Go down

Re: how to get data dynamically from Notepad file

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