making WebResponse GetResponse WebBot wait for redirect
-
28-05-2021 - |
Question
I am making a bot that simulates a human user using a specific website.
When the user uses the site here is what happens
- the user uploads a file by using the site's Browse button and then clicks Upload
- the server responds immediately and the user sees a Please Wait gif
- in the meantime the server is evaluating the file for errors. When it is done it redirects, and the user is take to a new .aspx page where they can correct the errors.
What I am not able to do w the bot is make it wait to get the redirect info.
The bot hits the website with this line of code (VB.NET)
Dim Response As HttpWebResponse = CType(Request.GetResponse(), HttpWebResponse)
The Response has the Please Wait gif in it, not the Errors.aspx page. Somehow I need to make the bot, execute that line of code above then, sorta listen to the same port(?) and wait for the web server to send another response.
Ideas?
Solution
I ended up just sleeping the thread, then hitting the url again, repeatedly till I got the response I wanted.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow