Element is not clickable in Protractor

微笑、不失礼 提交于 2019-12-13 04:26:36

问题


I am facing issue while interacting with any element in a modal popup. I am using ChromeDriver 2.46 and all tests which involves modal popup fails on Chrome 74.

I get below error

element is not clickable. Other element would receive the click

I have tried with scrollToTop, scrollToElement and visibilityOf but nothing worked. Has anyone faced similar issue?


回答1:


Attach you html, and full error stack

Meanwhile here is my assumption which is 90% likely what your problem is

Lets assume your html is something like

<div>
  <button></button>
</div>

your button is visible... but so is div element. BUT because wraps the button, it is above the button (has higher z-index). That's why when you click button, div gets this click, which protractor doesn't let happen. And fails

In this case just simply use js click

browser.executeScript(
  "arguments[0].click();",
  $element.getWebElement() // substitute $element to your elementFinder
)

this will work because element gets the click regardless of visibility and the page layout




回答2:


I suspect that Driver version and chrome version incompatibility could be the reason for your problem. Since chrome driver 2.46 supports v71-73 and you are using v74. We also observed that there are many evident instances of this. I would suggest first make sure that drive and chrome browser compatibility before running any test case.

Refer this link for browser and driver compatibility



来源:https://stackoverflow.com/questions/56471741/element-is-not-clickable-in-protractor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!