December 1, 201213 yr Newbies I new to this web scraping. This is my first time. I have looked at many examples and I can not see what is wrong. I always get a failure. Can someone please tell me what I am doing wrong. It does not seem to matter what web page I scrape of what tag I am looking for. If I go to "Chrome" I can see the source all ok. I am suspecting it is something external from the code .... Set Web Viewer [ Object Name: "source"; URL: "http://www.filemaker.com" ] # Loop Pause/Resume Script [ Duration (seconds): 1 ] Set Variable [ $html; Value:GetLayoutObjectAttribute("source";"content") ] Set Variable [ $elapsed; Value:Get(CurrentTimeStamp) - $start ] Exit Loop If [ PatternCount($html; "<head>") or $elapsed >30 ] End Loop Set Field [ Stats::H7Place; Length($html) ] If [ PatternCount($html; "<head>") < 1 ] Show Custom Dialog [ Title: "O'Dear o me"; Message: "******* Happens ..... "; Buttons: “OK”, “Cancel” ] Else Show Custom Dialog [ Title: "Looking good"; Message: "Got the data"; Buttons: “OK”, “Cancel” ] End If Thanks for you help Mike
December 1, 201213 yr I don't see the variable $start defined anywhere. If it's empty, then the loop will always exit during the first iteration, i.e. after one second. In addition, as Daniele says hints, you should be looking for the existence of "</html>" instead of "<head>". I would also make a distinction between: PatternCount ( $html ; "</html>" ) and: $elapsed > 30 The former exits the loop because of success, the latter because of failure. The script should not continue the same in both cases.
December 2, 201213 yr Author Newbies It does not seem to matter what tag I am looking for. Tried various Tags. Same result if I use "</html>" or any other tag. It just loops through for the duration of 30 seconds and then fails. It is if it just does not seem to go out to the web ....
Create an account or sign in to comment