问题
**Public Sub WebTest()
Dim keys As New keys, arr(), ws As Worksheet, i As Long
Dim temp1(), temp2() As String
'Set ws = ThisWorkbook.Worksheets("Sheet1") '<==Adjust to your sheet
arr = Application.Transpose(Selection) '<== Adjust to your range
With bot
.Start "Chrome"
.Get "url here"
For i = LBound(arr) To UBound(arr)
If Not IsEmpty(arr(i)) Then
If i > 1 Then
.ExecuteScript "window.open(arguments[0])", "url here"
.SwitchToNextWindow
End If
.FindElementByCss("[name=q]").SendKeys arr(i)
.SendKeys bot.keys.Enter
End If
Next
End With
End Sub**
I'm using the above code to fetch values from excel and search in a particular url. While executing its loading two searches and after that its showing an error as "run-time error 17 javascript error illegal invocation" I don't know what I'm missing in the code or which I need to alter.
来源:https://stackoverflow.com/questions/61640111/getting-error-while-using-a-script-in-vba