1

hi I am trying to access the page through mechanize get method.The page takes cookie of the previous page post request to give response. Can anyone tell me how to pass the cookie in the header of get method of Mechanize? I am trying the approach mentioned below but not hitting the result page not getting data of result page..


def get_body_2
{
 "ctl00$Content$ddSpecialization" => "Appellate Practice"
}
end

def post_request
    url = 'https://portal.ncbar.gov/verification/search.aspx'
    body = get_body_2
    page = @agent.post(url,body)
    @cookie_val = @agent.cookies[0]
end

def mechanize_call
    url = 'https://portal.ncbar.gov/Verification/results.aspx'
    byebug
    page = @agent.get(url,{"Cookie" => @cookie_val})
end

ajay_speed
  • 79
  • 9

0 Answers0