Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

scraping table in web page 1

sal21

Programmer
Apr 26, 2004
421
IT
based:

https://demo.istat.it/app/?i=D7B&l=it&a=2024

to have the result:

1) click on button: Vista Territoriale
2) click on radio button: Tutti i comuni della provincia selezionata (Seleziona la provincia)
3) choice Como
4) click on Listbox mese
choice Luglio
$) click on button Cerca

Appear a table with data.

I need to looping all the value of the table result.

Possible?
Tks
 
BTW, not quite sure why SoftwareRT has suggested scraping the page with Selenium, since the whole point of my suggestion of this alternative was that you'd be able to 'Export CSV'.

So here's my code for doing just that (albeit using the Edgedriver rather than the Chromedriver)
Rich (BB code):
Sub TEST_Edge()
    Dim BOT As New EdgeDriver

    BOT.Start "Edge", ""
    BOT.Get "https://demo.istat.it/app/?i=D7B&l=it&a=2024" ' Get is synchronous, adoids all that troublesome WAITing for all the page to load
    
    BOT.FindElementById("tab-1").Click
    BOT.FindElementById("provincerb-1").Click
    
    ' Select from dopdown by index value
    ' BOT.FindElementByXPath("//select[@id='mese']/option[@value='7']").Click
    
    ' Select from dopdown by name
    BOT.FindElementByXPath("//select[@id='mese']//option[. = 'Luglio']").Click
    
    BOT.FindElementById("btnricerca-1").Click ' retrieve table for selected options
    
    BOT.FindElementByCss(".buttons-csv > span").Click ' Download it
    BOT.Wait 500 ' allow time for file to successfully download. May need tweaking
End Sub
 

Part and Inventory Search

Sponsor

Back
Top