vb.net - Web scraping with a pop-up (Visual Basic) -
i'm trying scrape page, when login page displays pop before page need (welcome blah-blah-blah...don't hit refresh slow process...etc.etc...).
naturally, httpwebrequest scrapes data , not page follows.
the popup self cancels if httpwebrequest wait second or 2 , scrape, work - or - if can 2 scrapes (and discard 1st one) in same session work too.
here's code:
dim cookiejar new cookiecontainer dim request httpwebrequest = webrequest.createhttp(textbox1.text) request.cookiecontainer = new cookiecontainer() request.cookiecontainer.add(new uri(textbox1.text), new cookie("id", "1234")) request.preauthenticate = true request.credentials = credentialcache.defaultcredentials request.useragent = "user-agent: mozilla/5.0 (windows nt 6.1; wow64)" request.allowautoredirect = true request.maximumautomaticredirections = 4 request.maximumresponseheaderslength = 4 dim response webresponse = directcast(request.getresponse(), httpwebresponse) dim webresult string = new streamreader(response.getresponsestream()).readtoend() textbox2.text = webresult
thanks in advance suggestions.
Comments
Post a Comment