0

I have an issue with waiting in selenium. I want to press an element and get error about intercepted. I try all solutions like element is wait element is clickable and more, however nothing worked.

How can I resolve this exception, and tell selenium to wait for this element will be removed/not visible /gone ?

Sun Oct 27 14:03:53 IST 2019:INFO: WebDriver: Click on [[ChromeDriver: chrome on XP (bf4a41cbd3e7f6cfedb2f70301ed0512)] -> id: header-account]
Sun Oct 27 14:03:53 IST 2019:ERROR: element click intercepted: Element <button _ngcontent-egd-c11="" class="avatar-style ant-btn ant-btn-default ant-btn-circle" id="header-account" nz-button="" nz-popover="" nzplacement="bottomRight" nzshape="circle" nztrigger="click" ng-reflect-nz-shape="circle" ng-reflect-nz-content="[object Object]" ng-reflect-nz-trigger="click" ng-reflect-nz-placement="bottomRight" ng-reflect-directive-name-title="" nz-wave="[object Object]">...</button> is not clickable at point (1888, 31). Other element would receive the click: <path d="M563.8 512l262.5-312.9c4.4-5.2.7-13.1-6.1-13.1h-79.8c-4.7 0-9.2 2.1-12.3 5.7L511.6 449.8 295.1 191.7c-3-3.6-7.5-5.7-12.3-5.7H203c-6.8 0-10.5 7.9-6.1 13.1L459.4 512 196.9 824.9A7.95 7.95 0 0 0 203 838h79.8c4.7 0 9.2-2.1 12.3-5.7l216.5-258.1 216.5 258.1c3 3.6 7.5 5.7 12.3 5.7h79.8c6.8 0 10.5-7.9 6.1-13.1L563.8 512z"></path>
  (Session info: chrome=78.0.3904.70)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'PC', ip: '10.3.3', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_65'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 78.0.3904.70, chrome: {chromedriverVersion: 77.0.3865.40 (f484704e052e0..., userDataDir: C:\Users\Sagi\AppData\Local...}, goog:chromeOptions: {debuggerAddress: localhost:56066}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: XP, platformName: XP, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify}
Session ID: bf4a41cbd3e7f6cfedb2f70301ed0512

I just want selenium to wait until it will be clickable, and I can press the element. How I can overcome it? since no Id of the element that is getting the click and not Class just:

Other element would receive the click: <path d="M563.8 512l262.5-312.9c4.4-5.2.7-13.1-6.1-13.1h-79.8c-4.7 0-9.2 2.1-12.3 5.7L511.6 449.8 295.1 191.7c-3-3.6-7.5-5.7-12.3-5.7H203c-6.8 0-10.5 7.9-6.1 13.1L459.4 512 196.9 824.9A7.95 7.95 0 0 0 203 838h79.8c4.7 0 9.2-2.1 12.3-5.7l216.5-258.1 216.5 258.1c3 3.6 7.5 5.7 12.3 5.7h79.8c6.8 0 10.5-7.9 6.1-13.1L563.8 512z"></path>

That can be changed (Session info: chrome=78.0.3904.70)

2
  • As I can see you're using Angular. This framework as some others put a lot of desing-related elements around the nested one and those have custom elements. Eg. if you want to select an input field which has rounded borders or something like that than it will be rendered in a huge fragment. In this case a lot of elements are placed over the desired one so finally you won't click on the selected element but an element which is over. So the click event will be interceped by an other element. You have to get mouse control, move to selected elment and just click with mouse. Commented Oct 27, 2019 at 12:54
  • Yes and this is very frustrating, everything need to be modified. I have 19 method of wait for selenium to wait for an element. I want to close notification that DEV uses from (ng.ant.design/components/notification/en) and can not close it, So the element is blocked by this notification, I tried to wait the element is visible wait it will be clickable, and since it is partially visible it failed. I still not understand how to crack this issue, how to close the notification. the only soloution is hard coded sleep, Commented Oct 27, 2019 at 13:18

2 Answers 2

1

You can start chrome with zoomed out to like 75% I solved my problem using this but this will not be a perfect solution So, You can use

ActionChains(driver).move_by_offset(#coordinates).click().perform()

Then to revert into back to your original position, use

ActionChains(driver).move_by_offset(-coordinates).click().perform()
Sign up to request clarification or add additional context in comments.

Comments

0

please update your code.

Try to use Actions Class:

WebElement element = driver.findElement(By.id("header-account"));
Actions actions = new Actions(driver);
actions.moveToElement(element).click().build().perform();
  1. Element not getting clicked as it is not within Viewport

Try to use JavascriptExecutor to bring the element within the Viewport:

WebElement myelement = driver.findElement(By.id("header-account"));
JavascriptExecutor jse2 = (JavascriptExecutor)driver;
jse2.executeScript("arguments[0].scrollIntoView()", myelement); 

3 Comments

the problem is that the element is partially seen, there is a notification that partially hide it. the site is angular. I tried the Action soloution still no luck, selenium just not working OK with the new Angular JS sites
Can you post your site which you are trying to automate ?
see here more about this issue stackoverflow.com/questions/58578976/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.