RE: How to verify fields position in text file using Selenium Webdriver and Autoit

RE: How to verify fields position in text file using Selenium Webdriver and Autoit

this is my text file which I used to open in notepad++ and manually verify all the columns position are correctly populated or not. Now I want to automate this.
So please help me
Thanks

Add Comment
2 Answers

import java.io.BufferedReader;

import java.io.File;

import java.io.FileReader;

import java.io.IOException;

import java.util.ArrayList;

import java.util.Iterator;

import java.util.List;
public class FileRead {

//String[] Enum = {" "," "};

public void File(){

try {

File myFile = new File("C:\\Users\\amit.ja\\Desktop\\ciFile.txt");

FileReader fileReader = new FileReader(myFile);

BufferedReader br = new BufferedReader(fileReader);

String iRecord = null;

String[] iField = new String[10];

String sTemp=null;

ArrayList<String> iFieldSet= new ArrayList<String> ();

int iFiller=0;

while ( (iRecord=br.readLine())!= null){

//System.out.println(line) ;

iRecord.length();

iField= iRecord.split(" ");
for (int i=0;i<iField.length;i++) {

if (!iField[i].isEmpty()) {

if (iFiller>0) System.out.println("Filler length " + " = " + iFiller);iFiller=0;

System.out.println(iField[i] + " = " + iField[i].length());

//iFieldSet.add(iField[i]);
}

else {

iFiller++;

}

// if (!sTemp.isEmpty()) System.out.println(sTemp + " = " + sTemp.length());

}

Iterator it = iFieldSet.iterator();

while (it.hasNext()){
//TO DO Code.

}
}
br.close();

}
catch(Exception ex) {

ex.printStackTrace();

}

}
public void urlCheck() throws IOException, InterruptedException{

URL url = new URL("http://127.0.0.1:4725/wd/hub/status");

HttpURLConnection conn = (HttpURLConnection) url.openConnection();

conn.getURL();

if (conn.getResponseCode() != 200) {

throw new RuntimeException("Failed : HTTP error code : "

+ conn.getURL());

}

else System.out.println("conn.getResponseCode()" + conn.getResponseCode());

}
public static void main(String[] args) throws IOException, InterruptedException {

FileRead fr=new FileRead();

//fr.urlCheck();

fr.File();
}
}

Supporter Answered on April 15, 2015.

RE: How to verify fields position in text file using Selenium Webdriver and Autoit

on April 15, 2015.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.