I can´t click on an element with selenium, how can i click anyways?


i want to click this element but its says another element would be clicked, but i dont care because it´s a select:

let input_provinces = await driver.findElement(By.id("select_provinces")).click();

Does anyone know how to force the click?


I think you’re using Selenium with JavaScript , I’m providing a suggestion, you can try this one if it works for you.

let input_provinces = await driver.findElement(By.id("select_provinces"));
JavascriptExecutor executor = (JavascriptExecutor)driver;
executor.executeScript("arguments[0].click();", input_provinces);

Answered By – enthusiasticCoder

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published