Bug 915695 - NoSuchElementException is raised for some selenium tests occasionally
Summary: NoSuchElementException is raised for some selenium tests occasionally
Alias: None
Product: Beaker
Classification: Community
Component: tests
Version: 0.11
Hardware: Unspecified
OS: Unspecified
unspecified vote
Target Milestone: 0.12
Assignee: Qixiang Wan
QA Contact: Amit Saha
Whiteboard: ImplementationQuality
Depends On:
TreeView+ depends on / blocked
Reported: 2013-02-26 10:54 UTC by Qixiang Wan
Modified: 2018-02-06 00:41 UTC (History)
7 users (show)

Clone Of:
Last Closed: 2013-04-11 04:56:18 UTC

Attachments (Terms of Use)

Description Qixiang Wan 2013-02-26 10:54:15 UTC
Description of problem:
While running the selenium tests, test_labcontroller in IntegrationTests/src/bkr/inttest/server/selenium/test_distro_trees.py fails randomly with the following errors:

ERROR: test_labcontroller (bkr.inttest.server.selenium.test_distro_trees.DistroTreeViewTest)
Traceback (most recent call last):
  File "/root/devel/beaker/IntegrationTests/src/bkr/inttest/server/selenium/test_distro_trees.py", line 60, in test_labcontroller
  File "/usr/lib64/python2.6/site-packages/selenium/webdriver/remote/webdriver.py", line 214, in find_element_by_xpath
    return self.find_element(by=By.XPATH, value=xpath)
  File "/usr/lib64/python2.6/site-packages/selenium/webdriver/remote/webdriver.py", line 672, in find_element
    {'using': by, 'value': value})['value']
  File "/usr/lib64/python2.6/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in execute
  File "/usr/lib64/python2.6/site-packages/selenium/webdriver/remote/errorhandler.py", line 149, in check_response
    raise exception_class(message, screen, stacktrace)
NoSuchElementException: Message: u'Unable to locate element: {"method":"xpath","selector":"//div[@class=\\"flash\\"]"}' 

check the webdriver log, we can see:

webdriver [130226 15:46:21.57] [ 97.088s] [webdriver] Received command: clickElement
webdriver [130226 15:46:21.57] [ 97.093s] [webdriver] Using native events for click
webdriver [130226 15:46:21.58] [ 97.102s] [webdriver] Browser-specific offset (X,Y): 0, 89
webdriver [130226 15:46:22.40] [ 97.922s] [webdriver] Pending native events: false

compare to the success case, "Pending native events" should be "true" rather than "false" just after the clickElement command is received.  

This indicates the click event has been ignored by selenium/firefox, and there is a related issues in selenium group:

we can simply workaround this by disable native events.

Version-Release number of selected component (if applicable):

How reproducible:
about 10%

Steps to Reproduce:
1. ./run-tests.sh -sv bkr.inttest.server.selenium.test_distro_trees
2. repeat step 1 until see the failure
Actual results:
test_labcontroller failed

Expected results:

Additional info:

Comment 1 Qixiang Wan 2013-02-26 11:15:55 UTC
on gerrit: http://gerrit.beaker-project.org/#/c/1752/

Comment 2 Amit Saha 2013-03-27 02:37:57 UTC
Considering the occasional nature of the exception, i ran it a few times and it didn't happen. Also verified with the suggested fix from the Google group conversation and it seems to have done the trick.

Setting it to verified.

Comment 3 Dan Callaghan 2013-04-11 04:56:18 UTC
Beaker 0.12 has been released.

Note You need to log in before you can comment on or make changes to this bug.