Newbies Mdroil Posted December 1, 2012 Newbies Share Posted December 1, 2012 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 Link to comment Share on other sites More sharing options...
Raybaudi Posted December 1, 2012 Share Posted December 1, 2012 Which is the last closing tag of a well formatted HTML page ? Link to comment Share on other sites More sharing options...
comment Posted December 1, 2012 Share Posted December 1, 2012 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. Link to comment Share on other sites More sharing options...
Newbies Mdroil Posted December 2, 2012 Author Newbies Share Posted December 2, 2012 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 .... Link to comment Share on other sites More sharing options...
comment Posted December 2, 2012 Share Posted December 2, 2012 Are you sure you have named your web viewer correctly? Link to comment Share on other sites More sharing options...
Recommended Posts
This topic is 4174 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 accountSign in
Already have an account? Sign in here.
Sign In Now