RobotFramework AngularJS lib

(Omer) #1

I’m using SeleniumLibrary and I need AngularJS library for my testing, however I get an error when trying to locate a web element.
The test runs well when I remove AngularJS library.
Anyone knows how to resolve this?

(Omer) #2

Here is a more explicit error:

KEYWORD AngularJSLibrary . Wait For Angular
Start / End / Elapsed: 20181127 10:44:27.861 / 20181127 10:44:28.029 / 00:00:00.168
10:44:27.861 TRACE Arguments: [ ]
10:44:27.861 DEBUG POST {“script”: "\n var waiting = true;\n var callback = function () {waiting = false;}\n var el = document.querySelector(arguments[0]);\n if (window.angular && !(window.angular.version &&\n window.angular.version.major > 1)) {\n /* ng1 */\n angular.element(el).injector().get(’browser').\n notifyWhenNoOutstandingRequests(callback);\n } else if (window.getAngularTestability) {\n return !window.getAngularTestability(el).isStable(callback);\n } else if (window.getAllAngularTestabilities) {\n throw new Error('AngularJSLibrary does not currently handle ' +\n 'window.getAllAngularTestabilities. It does work on sites supporting ' +\n 'window.getAngularTestability. If you require this functionality, please ' +\n 'the library authors or reach out to the Robot Framework Users Group.');\n } else if (!window.angular) {\n throw new Error('window.angular is undefined. This could be either ' +\n 'because this is a non-angular page or because your test involves ' +\n 'client-side navigation. Currently the AngularJS Library is not ' +\n 'designed to wait in such situations. Instead you should explicitly ' +\n 'call the \"Wait For Angular\" keyword.');\n } else if (window.angular.version >= 2) {\n throw new Error('You appear to be using angular, but window.' +\n 'getAngularTestability was never set. This may be due to bad ' +\n 'obfuscation.');\n } else {\n throw new Error('Cannot get testability API for unknown angular ' +\n 'version \"' + window.angular.version + '\"');\n }\n return waiting;\n", "args": ["[ng-app]"], "sessionId": "71fe49bd4339a810ce2c25067c60d431"} 10:44:28.024 DEBUG "POST /session/71fe49bd4339a810ce2c25067c60d431/execute HTTP/1.1" 200 301 10:44:28.025 DEBUG Finished Request 10:44:28.029 FAIL WebDriverException: Message: unknown error: Cannot read property 'get' of undefined (Session info: chrome=70.0.3538.102) (Driver info: chromedriver=2.43.600210 (68dcf5eebde37173d4027fa8635e332711d2874a),platform=Windows NT 10.0.17134 x86_64) 10:44:28.029 DEBUG Traceback (most recent call last): File "c:\users\omer_n\appdata\local\programs\python\python37-32\lib\site-packages\AngularJSLibrary\", line 206, in wait_for_angular .until_not(lambda x: self._s2l._current_browser().execute_script(js_wait_for_angular, self.root_selector)) File "c:\users\omer_n\appdata\local\programs\python\python37-32\lib\site-packages\selenium\webdriver\support\", line 88, in until_not value = method(self._driver) File "c:\users\omer_n\appdata\local\programs\python\python37-32\lib\site-packages\AngularJSLibrary\", line 206, in <lambda> .until_not(lambda x: self._s2l._current_browser().execute_script(js_wait_for_angular, self.root_selector)) File "c:\users\omer_n\appdata\local\programs\python\python37-32\lib\site-packages\selenium\webdriver\remote\", line 636, in execute_script 'args': converted_args})['value'] File "c:\users\omer_n\appdata\local\programs\python\python37-32\lib\site-packages\selenium\webdriver\remote\", line 321, in execute self.error_handler.check_response(response) File "c:\users\omer_n\appdata\local\programs\python\python37-32\lib\site-packages\selenium\webdriver\remote\", line 242, in check_response raise exception_class(message, screen, stacktrace) 10:44:27.861 TRACE Arguments: [ ] 10:44:26.683 TRACE Arguments: [ {Username}={‘Email’: ‘’, ‘Password’: ‘123456’} ]