I'm wasting much time,come here to get help on Selenium.

5 lines VBA Code's Goal: click submit button after I put input data. *submit is in Korean.
Goal: Click submit button.
URL: https://datacentersupport.lenovo.com/us/ko/warrantylookup#/
input data: j30a7xlg (this hardcoded in this vba)

Error Des: at line of chd.FindElementByCss with runtime error
Run-time error '11':
element not interactable

'--------------------Below is compete Source Code
Sub Scrape()
    Dim chd As New Selenium.ChromeDriver
    chd.Get "https://datacentersupport.lenovo.com/us/ko/warrantylookup#/"
    chd.FindElementByClass("button-placeholder__input").SendKeys "j30a7xlg"

'Below line - ERROR Runtime 
    chd.FindElementByCss("#app-standalone-warrantylookup > div > div.warranty-lookup__content > div > div > div.basic-search__content > button").Click

    chd.Wait 5000
End Sub

1 Answer 1


Solved. Thanks to AmMilinPatel's great help. to me it's great!!

Using the help,I(user56534)completed my final source code and share for others's reference.
But it have a bug that I don't know the reason.If anyone know,please generous to me.
Bug description:The VBA clicks URL-1, then get URL-2 automatically well most case.
But in a great while,between URL-1 and URL-2, a alert window(see attached image) pop up.
In that cast, I must click one of two options. I want to do it in Code.
I tried chd.SwitchToAlert.Accept without success.
My new goal: how can click one of two options between URL-1 and URL-2.

Image desc: Because of not knowing how to upload image,I describe in text.
Based on IP,although physically user is in Switzerland,this website is in US.
Either forward to Switzerland or continue with this US site.
And then below, there're two icons. one is for Switzerland and the other is for US.

'My new revised complete code
Sub ScrapeWTY_Solved()
Dim ss As String
Dim i, j
    Dim chd As New Selenium.ChromeDriver

    Dim arr As Variant, item As Variant
    arr = Array("j30a7xlg", "J303A3DB")
    chd.Get "https://datacentersupport.lenovo.com/us/ko/warrantylookup#/"
For i = 1 To 10
For j = LBound(arr) To UBound(arr)
    chd.FindElementByClass("button-placeholder__input").SendKeys arr(j)
    ' Wait for the submit button to become clickable
    'chd.WaitElementPresentByCss("#app-standalone-warrantylookup button", timeout:=5000) 'Not working, Why?
    chd.Wait 5000
    'chd.SwitchToAlert.Accept 'Not working
    ' Click the submit button
    chd.FindElementByCss("#app-standalone-warrantylookup button").Click

    chd.Wait 5000
    Debug.Print i, j, arr(j), chd.FindElementByCss("#app-psp-warranty > div.psp-warranty__body > div > div.psp-warranty__status > div > div.warranty-status__content > div > div.chart-time-bucket > div.chart-expires > p:nth-child(2) > strong").Text
Next j
Next i

End Sub
  • Please post your new bug as a new question. You should also mark Milin Patel's answer as having solved your question. You can find more information about the way we do things here in the help center (sqa.stackexchange.com/help)
    – Kate Paulk
    Jun 30, 2023 at 12:14
  • I accepted the answer. I will post a new question when I get the bug case later.
    – rose1205
    Jul 3, 2023 at 0:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.