Being too nice ... running out of memory.

63 views
Skip to first unread message

johnjbarton

unread,
May 16, 2016, 1:44:04 PM5/16/16
to Selenium Developers
(I attempted to report this as a bug but the submit button is disabled).

In webdriver.js there is recursive code to convert parameters to  JSON:


The last category, where any object is processed recursively, is a problem for protractor as it would be for any modern js library: what happens if the object graph is circular?  Answer: we run out of memory. 

In our case we used `driver.switchTo().frame(iframe)` where `iframe` is a protractor ElementFinder. The argument is a complex object. `iframe.getWebElement()` is the correct input, but a small programmer error of failing to extract the WebElement results in an long delay then a crash.   This is very hard to debug because the code is all asynchronous and the point of failure is unexpected.

I think this attempt provide a friendly API is trying too hard and becomes self-defeating: the conversion is not very helpful and it's too easy to hit out of memory.  Simple requiring WebElement, simple type, or toJSON would be better.

jjb



Reply all
Reply to author
Forward
0 new messages