javascriptnode.jsseleniumselenium-webdriverchrome-web-driver

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? Thanks!


Solution

  • 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);