Hi
We are using JUnit+Selenium for functional testing of a web site in our project.
In several tests we need to download files from the website and compare it with a local resource.
We are using UrlResource to do this.
UrlResource actualResource = new UrlResource(URL);
compareUtil.isResourcesEquals(expectedResource, actualResouce);
This should work except that URL is protected by login.
So we use selenium to fetch the jsession id
String session = selenium.getCookieByName("JSESSIONID")
Works like a charm!
But now comes the problem. I need to add the session to the UrlResource. I tried just appending it tot he end of the URL
"http://companywebsite/user/files/6546464654/;jsessionid=" + session
But our website does not accept that. So I assue I need to append the session ID as a cookie to the UrlResource object. But I can't figure out how to do this.
Can you help us with this?
Or are we going about this the incorrect way. Should we use something else instead?