Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 4385 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies
Posted

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

Posted

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.

  • Newbies
Posted

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 ....

This topic is 4385 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.