Scraping iframe from w3Schools

Hi, I'm trying to scrape content within Iframe.
I don't have option to use source url to get the content since multiple validations performed and it just returns blank page when opened in new TAB ( Stock listing website)

The Iframe works perfectly when loaded from main page.
Therefore, I'm trying to scrape without opening the source URL.

I tried the usual selector iframe:iframe #frameID , however nothing appears in preview.
To test if its working properly in w3Schools, tried and still iframe:iframe #frameID not working.
Appreciate if someone share how to scrape from :
https://www.w3schools.com/howto/howto_js_element_iframe.asp

So I can apply the steps in Stock Website.
Thanks

Yea you need specify the correct selector located within the iframe. Usually you'd need to use the Chrome Inspector to find selectors in an iframe. This example will grab the text below w3schools.com in the iframe:

{"_id":"w3-iframe-test","startUrl":["https://www.w3schools.com/howto/howto_js_element_iframe.asp"],"selectors":[{"id":"test iframe scrape","type":"SelectorText","parentSelectors":["_root"],"selector":"iframe:iframe div.w3-hide-large.w3-hide-large.w3-padding-16 > div.w3-center.w3-wide.w3-hide-small","multiple":false,"regex":"","delay":0}]}

Ref: Using iframe:iframe properly

1 Like

Thanks a lot for the example leemeng.
It works now. Appreciate your help