Hello friends, i am trying to build a code with vba + selenium to extract a table in a web.
When executing the macro I get the following error "Element Not Found for Class=tablaHistoricoPrecio". I don't understand, because according to the structure of the web code the table has that definition. Any help would be appreciated. Greetings.
This is my vba code
This is the web code
This is a table screenshot
When executing the macro I get the following error "Element Not Found for Class=tablaHistoricoPrecio". I don't understand, because according to the structure of the web code the table has that definition. Any help would be appreciated. Greetings.
This is my vba code
VBA Code:
Private driver As New WebDriver
Sub repsol2022()
Dim GIGYA As Object
Set driver = New EdgeDriver
Dim rowc, cc, columnC As Integer
rowc = 2
With driver
.Start "edge"
.Get "https://repsol.force.com/portalGestorEESS/s/consultaPrecios"
With .FindElementByClass("gigya-login-form")
.FindElementByClass("gigya-input-text").SendKeys "xxx"
.FindElementByClass("gigya-input-password").SendKeys "xxx"
.FindElementByClass("gigya-input-submit").submit
End With
Application.Wait Now + TimeSerial(0, 0, 5)
For Each tr In driver.FindElementByClass("tablaHistoricoPrecio").FindElementByTag("tbody").FindElementsByClass("precioDetalle")
columnC = 1
For Each th In tr.FindElementsByClass("precioDetalle")
Data.Cells(rowc, columnC).Value = th.Text
columnC = columnC + 1
Next th
rowc = rowc + 1
Next tr
End With
Exit Sub
End Sub
This is the web code
This is a table screenshot