I use IE object.
how to get this value in bold:
<div class="row rowPaginazione fsStd">
<div class="col-md-3">
Pagina 1 di 163
</div>
the link:
https://www.comuniecitta.it/comuni-italiani?pg1
get value from web page
-
- 4StarLounger
- Posts: 563
- Joined: 27 Jun 2021, 10:46
Re: get value from web page
Have a look at the getElementsByClassName function, e.g.
Code: Select all
Dim IE As New InternetExplorer
Dim divclass As Object
IE.navigate "https://www.comuniecitta.it/comuni-italiani?pg1"
Set divclass = IE.document.getElementsByClassName("col-md-3")
MsgBox Trim(Right(divclass(0).innerText, 4))
-
- PlatinumLounger
- Posts: 4368
- Joined: 26 Apr 2010, 17:36
Re: get value from web page
TKS BRO. work.SpeakEasy wrote: ↑22 Nov 2022, 12:24Have a look at the getElementsByClassName function, e.g.
Code: Select all
Dim IE As New InternetExplorer Dim divclass As Object IE.navigate "https://www.comuniecitta.it/comuni-italiani?pg1" Set divclass = IE.document.getElementsByClassName("col-md-3") MsgBox Trim(Right(divclass(0).innerText, 4))
idea to submit the button CERCA.?
link:
https://www.codiceinverso.it/servizi/codice-istat.html
put in "Inserisci il codice Istat"
a value similar 001001, and click on button cerca
You do not have the required permissions to view the files attached to this post.
-
- 4StarLounger
- Posts: 563
- Joined: 27 Jun 2021, 10:46
Re: get value from web page
For this specific example. something like:
Code: Select all
Dim IE As New InternetExplorer
Dim element As HTMLButtonElement
IE.navigate "https://www.codiceinverso.it/servizi/codice-istat.html"
' shoukd really wait for page to complete loading
Do Until IE.readyState = READYSTATE_COMPLETE
DoEvents
Loop
For Each element In IE.document.getElementsByTagName("input")
If element.Name = "istat" Then element.Value = "001001"
Next
For Each element In IE.document.getElementsByClassName("btn-submit") 'objCollection
If element.Type = "submit" And element.innerText = "Cerca" Then element.Click ' click button
Next
' should really wait for page to complete loading
Do Until IE.readyState = READYSTATE_COMPLETE
DoEvents
Loop
' At this point IE should have the new page
' so do stuff
IE.Quit 'clean up
-
- PlatinumLounger
- Posts: 4368
- Joined: 26 Apr 2010, 17:36
Re: get value from web page
great!SpeakEasy wrote: ↑24 Nov 2022, 10:37For this specific example. something like:
Code: Select all
Dim IE As New InternetExplorer Dim element As HTMLButtonElement IE.navigate "https://www.codiceinverso.it/servizi/codice-istat.html" ' shoukd really wait for page to complete loading Do Until IE.readyState = READYSTATE_COMPLETE DoEvents Loop For Each element In IE.document.getElementsByTagName("input") If element.Name = "istat" Then element.Value = "001001" Next For Each element In IE.document.getElementsByClassName("btn-submit") 'objCollection If element.Type = "submit" And element.innerText = "Cerca" Then element.Click ' click button Next ' should really wait for page to complete loading Do Until IE.readyState = READYSTATE_COMPLETE DoEvents Loop ' At this point IE should have the new page ' so do stuff IE.Quit 'clean up
tks.
-
- PlatinumLounger
- Posts: 4368
- Joined: 26 Apr 2010, 17:36
Re: get value from web page
sorry bro...SpeakEasy wrote: ↑22 Nov 2022, 12:24Have a look at the getElementsByClassName function, e.g.
Code: Select all
Dim IE As New InternetExplorer Dim divclass As Object IE.navigate "https://www.comuniecitta.it/comuni-italiani?pg1" Set divclass = IE.document.getElementsByClassName("col-md-3") MsgBox Trim(Right(divclass(0).innerText, 4))
now i need to get AG, uder a little arrow of image, are same parameter or not?
link page:
https://www.tuttitalia.it/sicilia/provi ... agrigento/
You do not have the required permissions to view the files attached to this post.