无法使用JavaScript和Jest框架的Selenium自动化关闭CDK下拉菜单。

huangapple go评论105阅读模式
英文:

Unable to close the cdk dropdown in automation using selenium with javascript and jest framewok

问题

在CDK多选下拉框中,当我点击下拉以打开它时,它在整个屏幕上创建一个遮罩,因此屏幕外的元素都不可点击,因此我无法通过Selenium WebDriver执行点击事件。它始终显示一个元素不可交互的异常,当我提供隐式等待时,它不会显示任何异常,但下拉框仍然保持打开状态。

英文:

In CDK multi-select dropdown, when I click dropdown to open it make a mask on whole screen as a result there are no elements outside that is clickable, due to this I am not able to perform click event on it through selenium webdriver. It always shows an exception that element not interactable and when I provide implicit wait then it does not shows any exception but the dropdown remains open.

答案1

得分: 0

我搜索了很多,最终找到了一个解决方法,即在Selenium Web驱动中有一个executeScript方法可以解决我的问题。我在参数中使用了driver.executeScript(""),我以字符串的形式插入了DOM方法,以点击坐标来关闭下拉菜单,但我不明白它是如何工作的。

英文:

I search a lot and finally got a solution that there is an executeScript in selenium web-driver which solve my problem. I used driver.executeScript("") in parameter I inserted DOM method in form of string to click the coordinate to close the dropdown but I don't get how it works.

huangapple
  • 本文由 发表于 2020年1月7日 01:17:37
  • 转载请务必保留本文链接:https://go.coder-hub.com/59616310.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定