Open a URL with parameters using selenium.open()

Posted by gagneet on Stack Overflow See other posts from Stack Overflow or by gagneet
Published on 2010-05-27T07:12:20Z Indexed on 2010/05/27 7:21 UTC
Read the original article Hit count: 1002

Filed under:
|
|
|

I am using selenium.open(), to open a URL, which prints the cookie output to the browser window:

String cookiestr = "http://my.server.com/cookie?out=text";
selenium.open( cookiestr );

The problem is that, it opens a "Save As..." popup, to save the file named "cookie". When I open the same URL in my browser directly, it displays text in the browser window.

I want to capture the body text shown, when I open the URL, but am unable to do so. Is there any other command available which I can use to do this?

BufferedWriter outputfile = null;
String bodytext = selenium.getBodyText();
System.out.println("Body Text  :" + bodytext);
Integer I = new Integer(i);
filename = "C:\\cookies\\" + I.toString() + ".txt";
outputfile = new BufferedWriter(new FileWriter( filename ));
outputfile.write( bodytext );
outputfile.newLine();
i++;

© Stack Overflow or respective owner

Related posts about java

Related posts about selenium