there have recently been some ocurrences of StaleElementReferenceException.
[ ] tests.foreman.ui.test_puppetclass.PuppetClassTestCase.test_positive_update_description (3)
[ ] tests.foreman.ui.test_contentview.ContentViewTestCase.test_positive_edit_rh_custom_spin
[ ] tests.foreman.ui.test_contentview.ContentViewTestCase.test_positive_add_rh_content
these are most probably issue caused by our automation
[ ] tests.foreman.ui.test_activationkey.ActivationKeyTestCase.test_positive_create_with_envs
[] DiscoveryTestCase.test_positive_refresh_facts*
> raise exception_class(message, screen, stacktrace)
E StaleElementReferenceException: Message: Element is no longer attached to the DOM
E For documentation on this error, please visit: http://seleniumhq.org/exceptions/stale_element_reference.html
E Build info: version: '2.53.0', revision: '35ae25b', time: '2016-03-15 17:00:58'
E System info: host: 'afaec9d70fd3', ip: '172.17.0.7', os.name: 'Linux', os.arch: 'amd64', os.version: '4.3.3-301.fc23.x86_64', java.version: '1.8.0_03-Ubuntu'
E Driver info: driver.version: unknown
E Screenshot: available via screen
E Stacktrace:
E at <anonymous class>.fxdriver.cache.getElementAt (resource://fxdriver/modules/web-element-cache.js:9457)
E at <anonymous class>.Utils.getElementAt (file:///tmp/anonymous8371480420810262652webdriver-profile/extensions/[email protected]/components/driver-component.js:9039)
E at <anonymous class>.Utils.unwrapParameters (file:///tmp/anonymous8371480420810262652webdriver-profile/extensions/[email protected]/components/driver-component.js:9262)
E at <anonymous class>.Utils.unwrapParameters (file:///tmp/anonymous8371480420810262652webdriver-profile/extensions/[email protected]/components/driver-component.js:9272)
E at <anonymous class>.injectAndExecuteScript (file:///tmp/anonymous8371480420810262652webdriver-profile/extensions/[email protected]/components/driver-component.js:10665)
E at <anonymous class>.FirefoxDriver.prototype.executeScript (file:///tmp/anonymous8371480420810262652webdriver-profile/extensions/[email protected]/components/driver-component.js:10729)
E at <anonymous class>.DelayedCommand.prototype.executeInternal_/h (file:///tmp/anonymous8371480420810262652webdriver-profile/extensions/[email protected]/components/command-processor.js:12661)
E at <anonymous class>.DelayedCommand.prototype.executeInternal_ (file:///tmp/anonymous8371480420810262652webdriver-profile/extensions/[email protected]/components/command-processor.js:12666)
E at <anonymous class>.DelayedCommand.prototype.execute/< (file:///tmp/anonymous8371480420810262652webdriver-profile/extensions/[email protected]/components/command-processor.js:12608)
will update the info after i find out where exactly this happens
@rochacbruno Upstream Failures ? what do you mean by this label?
@lpramuk That means that this issue is related to a failure in our upstream build
tests.foreman.ui.test_puppetclass.PuppetClassTestCase.test_positive_update_description
failed one time from 10 builds
passed in latest tests build 29
passed locally http://pastebin.test.redhat.com/447565
tests.foreman.ui.test_contentview.ContentViewTestCase.test_positive_edit_rh_custom_spin
locally Passed http://pastebin.test.redhat.com/448053
Failures root cause:
@rplevka @rochacbruno can we close this issue as we have nothing here to fix
@ldjebran i'd like to see this 'fixed' at least in a way that it would fail with the proper Exception + message.
Thanks for investigation
another occurrence: tests.foreman.ui.test_contentview.ContentViewTestCase.test_positive_add_rh_content
..added to the checklist
it seemed to occur on trying to switch the org context:
2017-01-26 00:20:16 - robottelo.ui.locators - DEBUG - Accessing locator "menu.any_context" by xpath: "//div[contains(@style,'static') or contains(@style,'fixed')]//li[contains(@class,'org-switcher')]/a"
2017-01-26 00:20:16 - robottelo.ui.locators - DEBUG - Accessing locator "org.nav_current_org" by xpath: "(//div[contains(@style,'static') or contains(@style,'fixed')]//li[contains(@class,'org-switcher')]//li/a[@data-toggle='dropdown'])[1]"
2017-01-26 00:20:17 - robottelo - DEBUG - Finished Test: ContentViewTestCase/test_positive_add_rh_content
There is a behavior to raise exception some time when selecting org or when logout (when the test finished).
The fail occur when clicking on select combo list of org or account or when scrolling to the click area.
@ldjebran it might got something to do with the auto-refresh feature on the page (i know it exists on dashboard at least). Sometimes, when there is a lot of orgs and other stuff already, the switching to other org or page takes so much time, that the javascript autorefresh takes place and discards the request. It might also break the DOM references.
i have no proof to support this claim, it's just my own conspiracy theory that might be validated :)
@rplevka @ldjebran I opened a BZ for this problem a while ago https://bugzilla.redhat.com/show_bug.cgi?id=1334922
@rplevka @rochacbruno Thanks any way will make a PR to handle the exceptions properly at that places it seems there is no condition checking of the selenium web element
but still a problem when menu select:
considere the click in ui base
def click(self, target, wait_for_ajax=True,
ajax_timeout=30, waiter_timeout=12, scroll=True):
"""Locate the element described by the ``target`` and click on it.
:param tuple || WebElement target: Could be either locator that
describes the element or element itself.
:param wait_for_ajax: Flag that indicates if should wait for AJAX after
clicking on the element
:param ajax_timeout: The amount of time that wait_fox_ajax should wait.
This will have effect if ``wait_fox_ajax`` parameter is ``True``.
:param waiter_timeout: The amount of time that wait_until_element
should wait. That value should be specified when non-default delay
is needed (e.g. long run procedures)
:param scroll: Decide whether scroll to element in case it is located
out of the page
:raise: UINoSuchElementError if the element could not be found.
"""
if isinstance(target, tuple):
element = self.wait_until_element(target, timeout=waiter_timeout)
else:
element = target
if element is None:
raise UINoSuchElementError(
u'{0}: element {1} was not found while trying to click'
.format(type(self).__name__, target)
)
# Required since from selenium 2.48.0. which makes Selenium more
# closely resemble a user when interacting with elements.
# Scrolling element into view before attempting to click solves this.
# Behaviour can be changed with new selenium versions, so it is
# necessary to validate that functionality in case click method stopped
# to work as intended
if scroll:
self.scroll_into_view(element)
element.click()
if wait_for_ajax:
self.wait_for_ajax(ajax_timeout)
it may happen that the element became inconsistent between it's finding and the click
To resume my investigations:
we can split the problem in two categories:
1 - element None is passed to browser.execute_script robottelo use wait_until_element and in the case of a timeout a None element is returned, tried to resolve this case in this PR #4265
this is the of failure occured in tests.foreman.ui.test_contentview.ContentViewTestCase.test_positive_edit_rh_custom_spin
with this log http://pastebin.test.redhat.com/450301
2- the element loose his state between it was found and trying to click on it
all cases here happens on selecting the menu bar in the case of an org selection or when the test finish and what to logout. these class of error happens in function perform_action_chain_move when calling scroll_into_view(element)
I can propose to refactor like this: make 2 retries in case or StaleElementReferenceException
def perform_action_chain_move(self, locator, retry=true):
....
element = self.wait_until_element(locator)
....
try:
self.scroll_into_view(element)
ActionChains(self.browser).move_to_element(element).perform()
except StaleElementReferenceException:
if retry:
return self.perform_action_chain_move(locator, retry=False)
self.wait_for_ajax()
but this will help only for two case when robottello click on the org menu the first time after a refresh and when a test succeed and try to logout, in the cases when the menu list was opened and closed after a refresh this will not help.
any way after this step there is other wait_until_element where this exception can happen.
I've just submitted BZ1417946 which _may_ be the root cause of all stale element exceptions for org selector - if we have long org name in our org selector (automation creates few such orgs in tests), attempt to select any org above that one will immediately close the org selector.
But it can only appear a root cause in case automation moves the cursor upwards in the list.
open an issue https://github.com/SatelliteQE/robottelo/issues/4280 for execute_script with None element
@abalakh, may this is the same issue with the logout (in case of test succeeded)
Total 19 tests for upgrade , most of them are failing , while fetching org , or switch org. If this is due to long org name. Can we reduce the length of the org created for tests.
This is blocking the run of many tier3 and tier4 tests, which are crucial to be tested.
I am just speculating here, if we could atleast reduce the severity of this issue by fixing the org switching
I also see another variant of the issue , not cent percent sure, is this is same.
raise exception_class(message, screen, stacktrace)
E WebDriverException: Message: arguments[0] is null
E Build info: version: '2.48.0', revision: 'b7b081a', time: '2015-10-07 15:48:56'
E System info: host: 'hostname', ip: '0.0.0.0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12.1', java.version: '1.8.0_112'
E Driver info: driver.version: unknown
E Stacktrace:
E at <anonymous class>.anonymous (https://sat/ line 69 > Function:1)
E at <anonymous class>.handleEvaluateEvent (https://sat/:69)
../../shiningpanda/jobs/f41092af/virtualenvs/d41d8cd9/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py:181: WebDriverException
Please feel free to re-open, if this still needs fixing.
Most helpful comment
I've just submitted BZ1417946 which _may_ be the root cause of all stale element exceptions for org selector - if we have long org name in our org selector (automation creates few such orgs in tests), attempt to select any org above that one will immediately close the org selector.
But it can only appear a root cause in case automation moves the cursor upwards in the list.