Unable to check for availability of any element removing hardcoded delay

后端 未结 1 1663
孤独总比滥情好
孤独总比滥情好 2021-01-29 05:46

I\'ve written a script in vba in association with selenium to initiate a search in some torrent site. My script is doing fine but the problem is I had to use hardcoded del

相关标签:
1条回答
  • 2021-01-29 06:26

    Seems to have found the solution already. There is the link leading to github where Florent B. has provided an excellent solution as to how the script should wait until the desired element is available.

    This is how the script should be:

    Sub SearchItem()
    
        With New ChromeDriver
            .get "https://torrentz2.eu/"
            .FindElementByCss("#thesearchbox", timeout:=10000).SendKeys "Udemy"  ''wait for the element upto 10 seconds
            .FindElementByCss("#thesearchbutton").Click
        End With
    End Sub
    
    0 讨论(0)
提交回复
热议问题