I have the following code for a button:
<div class="header__login">
<button class="header__login-btn"> Login or Sign Up</button>
</div>
I have tried:
await driver.findElement(By.css('button.header__login-btn')).click();
await driver.findElement(By.className('header__login-btn')).click();
Neither of these works. It did not find the button.
Does anyone have a suggestion on how to get this to work?
Try using
await driver.findElement(By.cssSelector('button.header__login-btn')).click();
instead of
await driver.findElement(By.css('button.header__login-btn')).click();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.