Java – Can we make selenium webdriver to wait until user clicks on a webpage link at run-time without using implicit wait

javaseleniumselenium-webdriver

I am using Firefox driver with java and trying to scrape some data from a website. There is a human interaction involved in it and I have to ask the user to input a search string. And then accordingly user has to select which search result to open by analyzing with human eye. The effort is just to make few bits and pieces work faster through script.

My question is:

Can we make selenium webdriver to wait until user clicks on a webpage link at run-time without using implicit wait? I can not use implicit wait because the time for click may vary from few seconds to few minutes.

I am new to both java and selenium. Your help will be much appreciated.


Thanks

Best Answer

For sure you can. We use Selenium a lot as an assistant in getting some datas from websites.

When you have a process involving multiple steps, including opening website, login, choosing 54 parameters and need only 1 human interaction (resolving a captcha, for example), Selenium can automate those boring tasks and let the user concentrate on the one which is important.

What we do here, is to make a Swing dialog with an input field to get what the user want to enter, then the actual form submission is performed by Selenium. You can do the same thing with links, and you can ask the user to select a link to click on, and perform the actual click with webdriver.

The ExplicitWait method of Amith is also a good one. You can focus on what you expect after the user has clicked, and wait until this condition is realized