Skip to main content
2 of 2
Removed the irrelevant part of the answer

I like to use below format to avoid quotes errors:

WebElement element= driver.findElement(By.xpath("//div[@class='btnContr']/input[@value='Cancel']"));
        
JavascriptExecutor executor = (JavascriptExecutor) driver;
executor.executeScript("arguments[0].click();", element);