Thanks very much. Error looks useful for error handling... I think that's a secondary concern for me, though.
The big issue, I think (I'm still working on understanding what the crux of the problem is myself), is how to go back to a previous step.
For instance, if my program proceeds like this:
## Step 1
go_to_web_page_A();
## Step 2
look_for_stuff_on_web_page_A();
## Step 3
submit_form_on_A_to_go_to_B();
and it dies on step 2, that's almost always because step 1 failed. That is, it can't find the stuff it's looking for because the web page failed to load correctly.
So what I want to do is catch the failure of look_for_stuff_on_web_page_A() and, in case of a failure, retry go_to_web_page_A(); and then look_for_stuff_on_web_page_A(); a couple times before finally giving up.
Basically what it's doing is "Do A; Do B; If B fails, go back and do A again and then retry B;", and the part I'm having trouble with is the "If B fails, go back to A" part.
Any thoughts? |