Reputation: 1237
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)
Upvotes: 0
Views: 1978
Reputation: 57
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()
Upvotes: 1
Reputation: 4177
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();
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);
Upvotes: 0