I am automating a website in which I want to click on the x when a subscription popup comes up The HTML for the X is
<button title="Close popup message" data-testid="email-popup-close-button" id="email-popup-close-button" class="dw-1hfj58t-CloseBtn--EmailContainer e1lwf35p0">×</button>
So to click on this I am using the below
await driver.findElement(By.id("email-popup-close-button")).click();
But it is coming up with the below error
NoSuchElementError: no such element: Unable to locate element: {"method":"css selector","selector":"*[id="email-popup-close-button"]"}
Found the answer
Declared this
const {Builder, By, Key, until} = require("selenium-webdriver");
and used
let query = driver.wait(until.elementLocated(By.id('email-popup-close-button')));
await query.click();