Akarsh
Akarsh

Reputation: 19

How to get the response stream of browser in Java WebDriver program

I need to validate the PDF report. I need to get the report embeded in HTML. If I read that URL using:

File file = new File("url");

or

HttpWebConnection.getResponse();

it requests the URL in separate session, hence it cannot get the file.

Does ieDriver have something like HtmlUnit?

HttpWebConnection.getResponse()

or somebody can suggest alternative.

Upvotes: 1

Views: 1510

Answers (1)

JacekM
JacekM

Reputation: 4099

Unfortunately it does not. If you want to get the response code you will need a proxy. If you are using Java then Browser Mob is what you need. You may also try making XmlHttpRequest from javascript and get the status code in that way. You could also stick to the method you are using right now (separate request from Java) but pass the cookie with session (you can obtain the cookie from WebDriver)

Upvotes: 1

Related Questions