量角器单击隐藏元素“RangeError:超出最大调用堆栈大小”

时间:2020-12-28 01:25:25

I'm having an issue with trying to click a hidden element in a Protractor test.

我在尝试点击量角器测试中的隐藏元素时遇到问题。

Below is the error message that is being returned, as well the code snippet that is causing the error message. Any idea as to why this error is being thrown would be greatly appreciated.

下面是返回的错误消息,以及导致错误消息的代码段。任何关于为什么抛出这个错误的想法都将非常感激。

RangeError: Maximum call stack size exceeded


browser.driver.executeScript("return arguments[0].click()", bank_page.boaClick);

And "bank_page.boaClick()" is referenced as a variable on a page Object with the snippet seen below:

并且“bank_page.boaClick()”被引用为页面Object上的变量,其片段如下所示:

 boaClick: { get: function () { return element.all(by.model('bankConnection.bank')).get(0); }},

And below is the snippet that I am attempting to reference with that variable:

以下是我试图用该变量引用的片段:

<input type="radio" ng-model="bankConnection.bank" ng-value="bank" class="ng-valid ng-dirty" name="00D" value="[object Object]">

I basically just want to be able to click this radio button, but the button is a hidden element, so after searching online that first "browser.driver.executeScript" call seems to be the best option to achieve this, but I am getting the RangeError back since I have implemented it.

我基本上只是希望能够点击这个单选按钮,但是按钮是一个隐藏的元素,所以在线搜索后,第一个“browser.driver.executeScript”调用似乎是实现这一目标的最佳选择,但我得到了RangeError回来了,因为我已经实现了它。

1 个解决方案

#1


6  

executeScript does not take a page object. You need to pass in a raw web_element. (Protractor's element finder does not work either)

executeScript不接受页面对象。您需要传入原始web_element。 (量角器的元素查找器也不起作用)

Try:

browser.driver.executeScript("return arguments[0].click()", bank_page.boaClick.get().getWebElement());

#1


6  

executeScript does not take a page object. You need to pass in a raw web_element. (Protractor's element finder does not work either)

executeScript不接受页面对象。您需要传入原始web_element。 (量角器的元素查找器也不起作用)

Try:

browser.driver.executeScript("return arguments[0].click()", bank_page.boaClick.get().getWebElement());