0

I am passing one page, for example, Jsoup.connect("home.html") but this returns a response of any other page like "Login.html" as jsoup try to open "home.html" but this page requires login first.

Is there any way to store previous responses for jsoup somehow or directly get the required page's response?

  • https://jsoup.org/apidocs/org/jsoup/Connection.html You can also set headers on the connection. So may be you fist go to login, then do that, and whatever token you get, set it as a header. If you provide me github link of your code, I can show you how to do that.. or at least give me code snippet – Anand Vaidya Nov 14 '19 at 09:37
  • What do you mean previous responses? Do you want the response that you get before being redirected? Because that's most likely going to be an HTTP 302 with empty body, nothing to parse there. – Aaron Nov 14 '19 at 09:46
  • @AnandVaidya , Here is github link https://github.com/vrushofficial/Automation-of-testcase-generation/blob/master/test.java Actually I want to scrap this URL=[http://www.naukri.com/mnjuser/homepage] but I am geeting reponse of this [https://www.naukri.com/nlogin/login?] – Vrushabh Joshi Nov 14 '19 at 11:17
  • check out this thread - https://stackoverflow.com/questions/6432970/jsoup-posting-and-cookie – Anand Vaidya Nov 14 '19 at 13:43

0 Answers0