Extracting data from lightbox

105 views
Skip to first unread message

Aissam

unread,
Mar 1, 2015, 10:44:04 PM3/1/15
to web-s...@googlegroups.com
Hi there,

I have tried my best but I couldn't succeed extracting a phone number from a lightbox popup.
Here is my code please help me :

{"startUrl":"http://www.lamudi.ma/appartement-quartier-hopitaux-131061-29.html","selectors":[{"parentSelectors":["_root"],"type":"SelectorPopupLink","multiple":false,"id":"click","selector":"div.info a","delay":""},{"parentSelectors":["click"],"type":"SelectorText","multiple":false,"id":"phone","selector":"tr#mf22.number td.phone","regex":"","delay":""}],"_id":"testoo"}

Thank you,

Mārtiņš Balodis

unread,
Mar 2, 2015, 3:27:59 AM3/2/15
to Aissam, web-scraper
Hi,
Try using element click selector. For "click selector" select the button that needs to be clicked. Then for "selector" select the popup element. Add a child selector to the element click selector that extracts the phone. 

--
You received this message because you are subscribed to the Google Groups "Web Scraper" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web-scraper...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Aissam

unread,
Mar 2, 2015, 8:12:16 AM3/2/15
to web-s...@googlegroups.com, aour...@gmail.com
Hi,

Thanks for your answer.
I tried with the element click as followed but it still does not work:

{"selectors":[{"parentSelectors":["_root"],"type":"SelectorElementClick","multiple":false,"id":"click","selector":"div#form-request-phone","delay":"","clickElementSelector":"div.info a","clickElementUniquenessType":"uniqueText","clickType":"clickOnce","discardInitialElements":false},{"parentSelectors":["click"],"type":"SelectorText","multiple":false,"id":"phone","selector":"tr#mf22.number td.phone","regex":"","delay":""}],"startUrl":"http://www.lamudi.ma/appartement-quartier-hopitaux-131061-29.html","_id":"testoo2"}

Thank you,

Mārtiņš Balodis

unread,
Mar 3, 2015, 2:57:15 PM3/3/15
to Aissam, web-scraper
Hi,
your element click selector didn't have a delay. If the data is loaded from a remote server then it won't be appearing immediately. Try setting the delay to 1000 (1 second). The site actually isn't showing the phone for me but at least I could open the popup and extract text from it.

{"selectors":[{"parentSelectors":["_root"],"type":"SelectorElementClick","multiple":false,"id":"click","selector":"div#form-request-phone","delay":"1000","clickElementSelector":"div.info a","clickElementUniquenessType":"uniqueText","clickType":"clickOnce","discardInitialElements":false},{"parentSelectors":["click"],"type":"SelectorText","multiple":false,"id":"phone","selector":"tr#mf22.number td.phone","regex":"","delay":""},{"parentSelectors":["click"],"type":"SelectorText","multiple":false,"id":"txt","selector":"p","regex":"","delay":""}],"startUrl":"http://www.lamudi.ma/appartement-quartier-hopitaux-131061-29.html","_id":"testoo2"}

Aissam

unread,
Mar 3, 2015, 4:38:09 PM3/3/15
to web-s...@googlegroups.com, aour...@gmail.com
Thank you so much. Now its working ;)
Reply all
Reply to author
Forward
0 new messages