I am trying to automate the shopping website. when i select the shopping item and trying to 'Quick view’ an item i got a error as:
"ElementClickInterceptedException: Message: element click intercepted: Element is not clickable at point (608, 585). Other element would receive the click: …
"
code as below:
{select_view} xpath://*[@id="center_column"]/ul/li/div/div[1]/div/a[1]/img
Click Element {select_view}
Without seeing the page you are testing and with the information you have given, it’s a bit hard tell you anything more than the error already tells you, i.e. selenium couldn’t click the thing you told it to click because another element would have received the click, not the one you told it to click.
Common causes for this are:
There are elements overlapping in your page and there is another element in front of the element you are trying to click
You are trying to click an item in a carousel and the element you selected with {select_view} xpath://*[@id="center_column"]/ul/li/div/div[1]/div/a[1]/img has been switched with another in the meantime when you get to executing Click Element {select_view}
Of course there are other less common causes too you’ll need to have a look at the page with dev tools to figure out what is happening.
SeleniumTestability has this sort of functionality:
Run Keyword And Expect Error STARTS: ElementClickInterceptedException Click Button id:hiddenbutton
Element Should Be Blocked id:hiddenbutton
Hide Element id:infoi
Element Should Not Be Blocked id:hiddenbutton
Click Button id:hiddenbutton
Show Element id:infoi
Element Should Be Blocked id:hiddenbutton
Run Keyword And Expect Error STARTS: ElementClickInterceptedException Click Button id:hiddenbutton
Run Keyword And Expect Error STARTS: Element with locator Element Should Not Be Blocked id:hiddenbutton
Layout on of test page is so that there’s element partially on top of the button i want to click. Its not really covered but they overlap and because selenium tries to play ball with the automator, when i try to click on the button, selenium throws exception.
This is afaik due to selenium not knowing if the topmost element passes the click event forward. So while you as a user can click the mouse there and it will work as intended, on automation side, this could be problematic.
So, The example here checks that yes, id:button is blocked… Then i use Get WebElement for the container that is blocking the button. However, since you do not know what is blocking the element you are interested, you could first get the interaction elements web element, check its x/y coordinates and issue Get WebElement At keyword for those coordinates. This returns you the topmost element which you can then hide with Toggle Element Visibility …