Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError prevents error message from being shown #1526

Closed
oluoluoxenfree opened this issue Jan 25, 2016 · 2 comments
Closed

TypeError prevents error message from being shown #1526

oluoluoxenfree opened this issue Jan 25, 2016 · 2 comments
Labels

Comments

@oluoluoxenfree
Copy link

When an web element isn't clickable and an error response is sent from web driver, the type error below causes the actual error message not to be shown. This is using Firefox 43.04 and Selenium 2.49.2.

tests/pages.py:225: in fill_form
    return self.click_button('Send')
../envs/olu/local/lib/python2.7/site-packages/keteparaha/page.py:316: in click_button
    return self._click(component, opens)
../envs/olu/local/lib/python2.7/site-packages/keteparaha/page.py:263: in _click
    component._element.click()
../envs/olu/local/lib/python2.7/site-packages/selenium/webdriver/remote/webelement.py:75: in click
    self._execute(Command.CLICK_ELEMENT)
../envs/olu/local/lib/python2.7/site-packages/selenium/webdriver/remote/webelement.py:454: in _execute
    return self._parent.execute(command, params)
../envs/olu/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 0x7fe1f1719b90>
response = {'status': 500, 'value': '{"name":"clickElement","sessionId":"4407bbb1-373d-4e9d-a780-9ced144767ab","status":13,"value...ould receive the click: <div class=\"collapse navbar-collapse\" ng-class=\"!navCollapsed &amp;&amp; \'in\'\"></div>"}'}

    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
                try:
                  value = json.loads(value_json)
                  status = value.get('error', None)
                  if status is None:
                      status = value["status"]
>                     message = value["value"]["message"]
E                     TypeError: string indices must be integers
@barancev barancev added the C-py label Jan 25, 2016
@nikolas
Copy link
Contributor

nikolas commented Jan 28, 2016

This is the same problem as #1497

@barancev
Copy link
Member

Duplicate of #1497

@lock lock bot locked and limited conversation to collaborators Aug 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants