Skip to content

Instantly share code, notes, and snippets.

@AutomatedTester
Created July 7, 2011 08:56
Show Gist options
  • Select an option

  • Save AutomatedTester/1069128 to your computer and use it in GitHub Desktop.

Select an option

Save AutomatedTester/1069128 to your computer and use it in GitHub Desktop.
Python AUI failures on Firefox
_______ FirefoxAdvancedUserInteractionTest.testCannotMoveToANullLocator ________
self = <selenium.test.selenium.webdriver.firefox.test_ff_interactions.FirefoxAdvancedUserInteractionTest testMethod=testCannotMoveToANullLocator>
def testCannotMoveToANullLocator(self):
"""Copied from org.openqa.selenium.interactions.TestBasicMouseInterface."""
self._loadPage("javascriptPage")
try:
move = ActionChains(self.driver) \
.move_to_element(None)
move.perform()
self.fail("Shouldn't be allowed to click on null element.")
except AttributeError:
pass # Expected.
try:
ActionChains(self.driver).click().perform()
> self.fail("Shouldn't be allowed to click without a context.")
E AssertionError: Shouldn't be allowed to click without a context.
build/lib.linux-i686-2.6/selenium/test/selenium/webdriver/common/interactions_tests.py:151: AssertionError
_____________ FirefoxAdvancedUserInteractionTest.testContextClick ______________
self = <selenium.test.selenium.webdriver.firefox.test_ff_interactions.FirefoxAdvancedUserInteractionTest testMethod=testContextClick>
def testContextClick(self):
"""Copied from org.openqa.selenium.interactions.TestBasicMouseInterface."""
self._loadPage("javascriptPage")
toContextClick = self.driver.find_element_by_id("doubleClickField")
contextClick = ActionChains(self.driver) \
.context_click(toContextClick)
contextClick.perform()
self.assertEqual("ContextClicked",
> toContextClick.get_attribute('value'))
E AssertionError: 'ContextClicked' != 'DoubleHello'
build/lib.linux-i686-2.6/selenium/test/selenium/webdriver/common/interactions_tests.py:122: AssertionError
______________ FirefoxAdvancedUserInteractionTest.testDoubleClick ______________
self = <selenium.test.selenium.webdriver.firefox.test_ff_interactions.FirefoxAdvancedUserInteractionTest testMethod=testDoubleClick>
def testDoubleClick(self):
"""Copied from org.openqa.selenium.interactions.TestBasicMouseInterface."""
self._loadPage("javascriptPage")
toDoubleClick = self.driver.find_element_by_id("doubleClickField")
dblClick = ActionChains(self.driver) \
.double_click(toDoubleClick)
> dblClick.perform()
build/lib.linux-i686-2.6/selenium/test/selenium/webdriver/common/interactions_tests.py:109:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.common.action_chains.ActionChains object at 0x8cd4e0c>
def perform(self):
"""Performs all stored actions."""
for action in self._actions:
> action()
build/lib.linux-i686-2.6/selenium/webdriver/common/action_chains.py:35:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self._actions.append(lambda:
> self._driver.execute(Command.DOUBLE_CLICK, {}))
build/lib.linux-i686-2.6/selenium/webdriver/common/action_chains.py:78:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.firefox.webdriver.WebDriver object at 0x8ccd78c>
driver_command = 'mouseDoubleClick'
params = {'sessionId': u'545995e9-0fd8-42b4-9ce2-cc6257bf851f'}
def execute(self, driver_command, params=None):
"""Sends a command to be executed by a command.CommandExecutor.
Args:
driver_command: The name of the command to execute as a string.
params: A dictionary of named parameters to send with the command.
Returns:
The command's JSON response loaded into a dictionary object.
"""
if not params:
params = {'sessionId': self.session_id}
elif 'sessionId' not in params:
params['sessionId'] = self.session_id
params = self._wrap_value(params)
response = self.command_executor.execute(driver_command, params)
if response:
> self.error_handler.check_response(response)
build/lib.linux-i686-2.6/selenium/webdriver/remote/webdriver.py:144:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x8ccd02c>
response = {u'name': u'mouseDoubleClick', u'sessionId': u'545995e9-0fd8-42b4-9ce2-cc6257bf851f', u'status': 13, u'value': {u'mess...'Error: Argument to isShown must be of type Element' when calling method: [wdIMouse::doubleClick]", u'stackTrace': []}}
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['status']
if status == ErrorCode.SUCCESS:
return
exception_class = ErrorInResponseException
if status == ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status == ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status == ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status == ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status == ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status == ErrorCode.INVALID_ELEMENT_STATE:
exception_class = WebDriverException
elif status == ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status == ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = WebDriverException
elif status == ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = WebDriverException
elif status == ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status == ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
else:
exception_class = WebDriverException
value = response['value']
if type(value) is str:
if exception_class == ErrorInResponseException:
raise exception_class(response, value)
raise exception_class(value)
message = ''
if 'message' in value:
message = value['message']
# TODO: What about 'screen' and 'stackTrace'?
if exception_class == ErrorInResponseException:
raise exception_class(response, message)
> raise exception_class(message)
E WebDriverException: 'Error: Argument to isShown must be of type Element' when calling method: [wdIMouse::doubleClick]
build/lib.linux-i686-2.6/selenium/webdriver/remote/errorhandler.py:100: WebDriverException
________ FirefoxAdvancedUserInteractionTest.testSelectingMultipleItems _________
self = <selenium.test.selenium.webdriver.firefox.test_ff_interactions.FirefoxAdvancedUserInteractionTest testMethod=testSelectingMultipleItems>
def testSelectingMultipleItems(self):
"""Copied from org.openqa.selenium.interactions.CombinedInputActionsTest."""
self._loadPage("selectableItems")
reportingElement = self.driver.find_element_by_id("infodiv")
self.assertEqual("no info", reportingElement.text)
listItems = self.driver.find_elements_by_tag_name("li")
selectThreeItems = ActionChains(self.driver) \
.key_down(Keys.CONTROL) \
.click(listItems[1]) \
.click(listItems[3]) \
.click(listItems[5]) \
.key_up(Keys.CONTROL)
> selectThreeItems.perform()
build/lib.linux-i686-2.6/selenium/test/selenium/webdriver/common/interactions_tests.py:188:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.common.action_chains.ActionChains object at 0x8cd474c>
def perform(self):
"""Performs all stored actions."""
for action in self._actions:
> action()
build/lib.linux-i686-2.6/selenium/webdriver/common/action_chains.py:35:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self._actions.append(lambda:
self._driver.execute(Command.SEND_MODIFIER_KEY_TO_ACTIVE_ELEMENT, {
"value": key,
> "isdown": True}))
build/lib.linux-i686-2.6/selenium/webdriver/common/action_chains.py:104:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.firefox.webdriver.WebDriver object at 0x8ccd78c>
driver_command = 'sendModifierKeyToActiveElement'
params = {'isdown': True, 'sessionId': u'545995e9-0fd8-42b4-9ce2-cc6257bf851f', 'value': u'\ue009'}
def execute(self, driver_command, params=None):
"""Sends a command to be executed by a command.CommandExecutor.
Args:
driver_command: The name of the command to execute as a string.
params: A dictionary of named parameters to send with the command.
Returns:
The command's JSON response loaded into a dictionary object.
"""
if not params:
params = {'sessionId': self.session_id}
elif 'sessionId' not in params:
params['sessionId'] = self.session_id
params = self._wrap_value(params)
response = self.command_executor.execute(driver_command, params)
if response:
> self.error_handler.check_response(response)
build/lib.linux-i686-2.6/selenium/webdriver/remote/webdriver.py:144:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x8ccd02c>
response = {'status': 404, 'value': 'Unrecognized command: POST /session/545995e9-0fd8-42b4-9ce2-cc6257bf851f/modifier'}
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['status']
if status == ErrorCode.SUCCESS:
return
exception_class = ErrorInResponseException
if status == ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status == ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status == ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status == ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status == ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status == ErrorCode.INVALID_ELEMENT_STATE:
exception_class = WebDriverException
elif status == ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status == ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = WebDriverException
elif status == ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = WebDriverException
elif status == ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status == ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
else:
exception_class = WebDriverException
value = response['value']
if type(value) is str:
if exception_class == ErrorInResponseException:
raise exception_class(response, value)
> raise exception_class(value)
E WebDriverException: Unrecognized command: POST /session/545995e9-0fd8-42b4-9ce2-cc6257bf851f/modifier
build/lib.linux-i686-2.6/selenium/webdriver/remote/errorhandler.py:93: WebDriverException
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment