-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Description
Hi, i have a problem when I use pytractor:
E TimeoutException: Message: asynchronous script timeout: result was not received in 10 seconds
E (Session info: chrome=54.0.2840.100)
E (Driver info: chromedriver=2.26.436382 (70eb799287ce4c2208441fc057053a5b07ceabac),platform=Linux 4.4.0-57-generic x86_64)
I attempt to use it to test a SPA website and an exceptions occurs. The traceback tells me that it was in driver.wait_for_angular().
What I am testing is a datetimepicker component and I want to trigger a click event on it but failed.
But when I use a raw webdriver to rewrite the program, it works normally. So I guess there is some problems here?
I am using angular 1.5. Tank you very much!
details for my problem:
BROWSER_URL=
ui installed: adium-theme-ubuntu==0.3.4,ansi2html==1.1.1,astroid==1.4.4,backports.ssl-match-hostname==3.5.0.1,cached-property==1.3.0,click==6.6,configparser==3.5.0,coverage==4.2,Cython==0.25.1,decorator==4.0.10,devrest==2.2.8,docker-compose==1.9.0,docker-py==1.10.6,docker-pycreds==0.2.1,dockerpty==0.4.1,docopt==0.6.2,EditorConfig==0.12.1,enum34==1.1.6,Flask==0.11.1,Flask-Admin==1.4.2,Flask-SQLAlchemy==2.1,funcsigs==0.4,functools32==3.2.3.post2,future==0.15.2,futures==2.1.6,gitdb2==2.0.0,GitPython==2.1.0,gunicorn==19.4.5,inflect==0.2.5,ipaddress==1.0.17,ipython==2.4.1,itsdangerous==0.24,Jinja2==2.8,jsbeautifier==1.6.4,jsonschema==2.5.1,lazy-object-proxy==1.2.1,logilab-common==1.1.0,MarkupSafe==0.23,mock==1.3.0,mocktest==0.7.2,mongoengine==0.11.0,MySQL-python==1.2.5,mysqlclient==1.3.7,nose==1.3.7,numpy==1.11.0,ordereddict==1.1,pbr==1.8.1,pexpect==4.0.1,pluggy==0.4.0,ptyprocess==0.5,py==1.4.31,pygobject==3.20.0,pylint==1.5.2,pymongo==3.4.0,pytest==2.9.2,pytest-cov==2.4.0,pytest-html==1.12.0,pytest-instafail==0.3.0,PyYAML==3.12,requests==2.11.1,selenium==2.48.0,simplegeneric==0.8.1,six==1.10.0,smmap2==2.0.1,sqlacodegen==1.1.6,SQLAlchemy==1.1.2,texttable==0.8.7,tox==2.5.0,unity-lens-photos==1.0,virtualenv==15.1.0,websocket-client==0.37.0,Werkzeug==0.11.11,wrapt==1.8.0,wsgi-intercept==1.4.1,WTForms==2.1
ui runtests: PYTHONHASHSEED='4195175843'
ui runtests: commands[0] | py.test --junitxml=var/report/junit-ui.xml --html=var/report/pytest-ui.html --self-contained-html -c deps/devtest/misc/tox.ini code
========================================================================================================= test session starts =========================================================================================================
platform linux2 -- Python 2.7.12, pytest-2.9.2, py-1.4.31, pluggy-0.3.1
rootdir: /home/yejq/Desktop/demo-ui-test/code, inifile: deps/devtest/misc/tox.ini
plugins: instafail-0.3.0, html-1.12.0, cov-2.4.0
collected 1 items
code/test_system1.py F
----------------------------------------------------------------------------- generated xml file: /home/yejq/Desktop/demo-ui-test/var/report/junit-ui.xml -----------------------------------------------------------------------------
--------------------------------------------------------------------------- generated html file: /home/yejq/Desktop/demo-ui-test/var/report/pytest-ui.html ----------------------------------------------------------------------------
============================================================================================================== FAILURES ===============================================================================================================
___________________________________________________________________________________________________ TestDatetimepicker.test_simple ____________________________________________________________________________________________________
self = <code.test_system1.TestDatetimepicker object at 0x7fa9804f5c10>, page = <code.common.web.CommonPage object at 0x7fa9804f5d90>
def test_simple(self, page):
driver = page.driver
> driver.find_element_by_xpath("(//input[@type='text'])[2]").click()
code/test_system1.py:11:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
var/.tox/ui/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py:258: in find_element_by_xpath
return self.find_element(by=By.XPATH, value=xpath)
deps/devtest/pytractor/mixins.py:54: in wait_for_angular
driver.wait_for_angular()
deps/devtest/pytractor/mixins.py:97: in wait_for_angular
async=True)
deps/devtest/pytractor/mixins.py:86: in _execute_client_script
result = self.execute_async_script(js_script, *args)
var/.tox/ui/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py:444: in execute_async_script
{'script': script, 'args':converted_args})['value']
deps/devtest/pytractor/mixins.py:105: in execute
params=params)
var/.tox/ui/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py:201: in execute
self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x7fa980529c90>
response = {'sessionId': '39fc924e76d3b669357cd8b3d517288b', 'status': 28, 'value': {'message': 'asynchronous script timeout: res...er info: chromedriver=2.26.436382 (70eb799287ce4c2208441fc057053a5b07ceabac),platform=Linux 4.4.0-57-generic x86_64)'}}
def check_response(self, response):
"""
Checks that a JSON response from the WebDriver does not have an error.
:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.
:Raises: If the response contains an error message.
"""
status = response.get('status', None)
if status is None or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get('value', None)
if value_json and isinstance(value_json, basestring):
import json
value = json.loads(value_json)
status = value['error']
message = value['message']
exception_class = ErrorInResponseException
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif status in ErrorCode.INVALID_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = WebDriverException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = WebDriverException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
else:
exception_class = WebDriverException
value = response['value']
if isinstance(value, basestring):
if exception_class == ErrorInResponseException:
raise exception_class(response, value)
raise exception_class(value)
message = ''
if 'message' in value:
message = value['message']
screen = None
if 'screen' in value:
screen = value['screen']
stacktrace = None
if 'stackTrace' in value and value['stackTrace']:
stacktrace = []
try:
for frame in value['stackTrace']:
line = self._value_or_default(frame, 'lineNumber', '')
file = self._value_or_default(frame, 'fileName', '<anonymous>')
if line:
file = "%s:%s" % (file, line)
meth = self._value_or_default(frame, 'methodName', '<anonymous>')
if 'className' in frame:
meth = "%s.%s" % (frame['className'], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == ErrorInResponseException:
raise exception_class(response, message)
elif exception_class == UnexpectedAlertPresentException and 'alert' in value:
raise exception_class(message, screen, stacktrace, value['alert'].get('text'))
> raise exception_class(message, screen, stacktrace)
E TimeoutException: Message: asynchronous script timeout: result was not received in 10 seconds
E (Session info: chrome=54.0.2840.100)
E (Driver info: chromedriver=2.26.436382 (70eb799287ce4c2208441fc057053a5b07ceabac),platform=Linux 4.4.0-57-generic x86_64)
var/.tox/ui/local/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py:181: TimeoutException
-------------------------------------------------------------------------------------------------------- Captured stderr setup --------------------------------------------------------------------------------------------------------
INFO: 2016-12-21 23:18:12,089: devtest.ui.browser 19836 browser.py:89 - browser(http://127.0.0.1:55719:2a1d5b4428aff507177c3d7533cfb0ca) -> http://demo.nie.netease.com
INFO: 2016-12-21 23:18:12,665: devtest.ui.browser 19836 browser.py:89 - browser(None:None) -> http://demo.nie.netease.com
INFO: 2016-12-21 23:18:25,664: devtest.ui.browser 19836 browser.py:122 - auth login with
====================================================================================================== 1 failed in 26.74 seconds ======================================================================================================
ERROR: InvocationError: '/home/yejq/Desktop/demo-ui-test/var/.tox/ui/bin/py.test --junitxml=var/report/junit-ui.xml --html=var/report/pytest-ui.html --self-contained-html -c deps/devtest/misc/tox.ini code'
_______________________________________________________________________________________________________________ summary _______________________________________________________________________________________________________________
ERROR: ui: commands failed
Metadata
Metadata
Assignees
Labels
No labels