I am trying to click a button which is overlapped by some image, but it is not getting clicked, Can some please help me to solve this problem?
            Asked
            
        
        
            Active
            
        
            Viewed 487 times
        
    -1
            
            
        - 
                    Please provide the relevant part of your code. Add a [Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve) including proper example input/output data. – Bsquare ℬℬ Nov 20 '18 at 13:03
 - 
                    Do you know how users of the app are supposed to click a button that is hidden by some image? Answering this question in your initial question may help to find a better solution. So far the answer provided by @Rostyslav Barmakov looks acceptable – Vladimir Efimov Nov 20 '18 at 13:33
 - 
                    Read through this discussion, this might give you some [ideas](https://stackoverflow.com/questions/11908249/debugging-element-is-not-clickable-at-point-error). – Mate Mrše Nov 21 '18 at 13:18
 - 
                    I consider this an issue, you may want to report it. – Neagu V Dec 24 '18 at 13:12
 
1 Answers
2
            
            
        You can use JavascriptExecutor to hide image and then do what you need:
// hide image
WebElement image = driver.findElement(By.id("image"));
JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("arguments[0].setAttribute('display', 'none')", image);
// click button
driver.findElement(By.id("button")).click();
// display image
js.executeScript("arguments[0].setAttribute('display', 'block')", image);
        Rostyslav Barmakov
        
- 186
 - 9