开发者

Open a URL with parameters using selenium.open()

开发者 https://www.devze.com 2023-01-01 00:41 出处:网络
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\";

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++;


your cookie servlet should set content type:

response.setContentType("text/plain");
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号