Skip to main content
Removed the irrelevant part of the answer
Source Link

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

Hope it will help you :)

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

Hope it will help you :)

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);
Source Link

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

Hope it will help you :)