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 delay
within my script to make it successful. What I wish to do now is check for the availability of desired element using some loop or any of that sort by kicking out hardcoded delay from my script. Any help on this will be highly appreciated.
This is my attempt so far (working one):
Sub SearchItem()
With New ChromeDriver
.get "https://torrentz2.eu/"
Application.Wait Now + TimeValue("00:00:10") ''I wish to shake this hardcoded delay off
.FindElementByCss("#thesearchbox").SendKeys ("Udemy")
.FindElementByCss("#thesearchbutton").Click
End With
End Sub
Reference to add:
Selenium Type Library
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: