Click here to Skip to main content
15,867,568 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
not all the pages; but some of them, specially those containing ads, take really long to be loaded while the elements that are going to be clicked are already usable.
how to set selenium to click on the elements after 1-2 seconds regardless of if pages are completely loaded or not? or, if there is another way not to wait for the page to be completely loaded and click on elements after a very short time?
for example:

driver.get("https://www.playok.com/en/spades/");
    		   
		       driver.findElement(By.cssSelector("button.ckbut.but0")).click();




it never clicks the element until (a long time in low speed connections) the page and all its ads are loaded.

What I have tried:

none of the solutions that include using WebDriverWait or pressing escape on 'body' of the page, solves the issue.
Posted
Updated 13-Apr-22 8:58am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900