I need to create a use case (using Selenium) in which I send HTTP calls with a Cookie through the browser and capture the return value in a text file.
What do I need to do this, I have run this using CURL in the command line, but we are encountering issues with the same, and hence wish to verify using a real UI browser.
Another thing to this is that I need to get the URL's to be in a test file from which I can read and send to the browser. Then for each call, I need to capture the cookie and the header for the same. I have the following code/logic for this, could someone elaborate?
---> read a file....
File aFile = new File("../blah.txt");
BufferedReader input = new BufferedReader( new FileReader( aFile ));
String line = null; //not declared within while loop
while (( line = input.readLine()) != null){
callsel(line);
System.out.println(line);
}
--> call selenium .. Open the url.. Pass cookies
public void callsel(String url) {
selenium.open(url);
selenium.waitForPageToLoad("120000");
selenium.createCookie("","");
selenium.createCookie("","");
selenium.open(url);
selenium.waitForPageToLoad("120000");
---> ur page is open now..
}
}