I have a code for web scraping. It operates pretty well but after some operations I can't figure how to proceed as there is no unique parameters to connect VBA commands to.
Here is my current code:
Sub ChechAutomate()
Dim ie As New InternetExplorer, url As String, ws As Worksheet
Set ws = ThisWorkbook.Sheets("Other Data")
url = "https://infra.com"
With ie
.Visible = True
.Navigate2 url
While .Busy Or .ReadyState < 4: DoEvents: Wend
With .Document
If .querySelectorAll("#login-bis-id-btn").Length > 0 Then
.querySelector("[name=userName]").Value = "username"
.querySelector("[name=password]").Value = "password"
.querySelector("[type=submit]").Click
Else
Application.Wait (Now + TimeValue("00:00:01"))
.querySelector("[id=companySearchKeyData]").Value = ws.Range("T24").Value
.querySelector("[type=submit]").Click
Application.Wait (Now + TimeValue("00:00:01"))
.querySelector("[name=creditType] [value='17']").Selected = True
Application.Wait (Now + TimeValue("00:00:01"))
.querySelector("[id=legalForms] [value='EN']").Selected = True
End If
End With
End With
End Sub
1) After upper code is ready I need to click this button:
I have tried .querySelector("[name=#]").Click
. Text "New decision" is changing within the language of the page. Also there are other type="button"
buttons.
2) After (1) has been done, I need to input value to this field:
I have tried to use .querySelector("[name=questions[0].answer]").Value = "1000"
it gives an error.
3) After (1) and (2) I need to click a button: