Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Protractor click hidden element " RangeError: Maximum call stack size exceeded"

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:

 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.

like image 685
parchambeau Avatar asked Jan 27 '15 11:01

parchambeau


1 Answers

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

Try:

browser.driver.executeScript("return arguments[0].click()", bank_page.boaClick.get().getWebElement());
like image 89
hankduan Avatar answered Sep 23 '22 06:09

hankduan