user3131471 :
How to click on the button
with the below HTML tag
<div class="_1WZqU PNlAR" role="button">OK</div>
I tried with the followings:
driver.findElement(By.xpath("//button[text()='OK']")).click();
driver.findElement(By.className("_1WZqU PNlAR")).click();
I got the following error message:
invalid selector: Compound class names not permitted
iamsankalp89 :
try using , button tag is not there in the HTML
//div[text()='OK']
use this code
driver.findElement(By.xpath("//div[text()='OK']")).click();
you can also use JavascriptExecutor
WebElement OKBtnElement = driver.findElement(By.xpath("//div[text()='OK']"));
JavascriptExecutor executor = (JavascriptExecutor)driver;
executor.executeScript("arguments[0].click();", OKBtnElement );