Skip to content

Interacting with the credential page fails with StaleElementReferenceException or WebDriverException #2002

@henryju

Description

@henryju

Jenkins and plugins versions report

Environment
<dependency>
  <groupId>org.jenkins-ci</groupId>
  <artifactId>acceptance-test-harness</artifactId>
  <version>6222.vb_ec234e3d81e</version>
</dependency>

Jenkins 2.479.3 with [email protected]_5534

also tested with

Jenkins 2.504.1 with [email protected]_5534

What Operating System are you using (both controller, and any agents involved in the problem)?

Linux

Reproduction steps

In our plugin acceptance tests, we have a scenario that involve creating a token. This was working for years, and it started to fail a few month ago.

    CredentialsPage mc = new CredentialsPage(jenkins, ManagedCredentials.DEFAULT_DOMAIN);
    mc.open();
    StringCredentials cred = mc.add(StringCredentials.class);
    cred.scope.select("GLOBAL");
    cred.secret.set(value);
    cred.setId(id);
    mc.create();

Expected Results

Credential is created without error

Actual Results

The token is created, (we can see it with the recorder), but there is some exception when the framework tries to check if a message is not displayed:

org.openqa.selenium.StaleElementReferenceException: 
stale element reference: stale element not found
  (Session info: chrome=135.0.7049.95)
For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#stale-element-reference-exception
Build info: version: '4.32.0', revision: 'd17c8aa950'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '6.1.132-147.221.amzn2023.x86_64', java.version: '17.0.14'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Command: [c3a6b1d601d44e1125e4f11f171db818, getElementText {id=f.3E3C55740D35B2CDDD2BC7286CD55D59.d.D2695DB648BE4949AA1097C21F77C289.e.1039}]
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 135.0.7049.95, chrome: {chromedriverVersion: 135.0.7049.95 (de2eb485a195..., userDataDir: /tmp/.org.chromium.Chromium...}, fedcm:accounts: true, goog:chromeOptions: {debuggerAddress: localhost:33677}, networkConnectionEnabled: false, pageLoadStrategy: normal, platformName: linux, proxy: Proxy(), se:cdp: ws://localhost:33677/devtoo..., se:cdpVersion: 135.0.7049.95, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:extension:minPinLength: true, webauthn:extension:prf: true, webauthn:virtualAuthenticators: true}
Element: [[ChromeDriver: chrome on linux (c3a6b1d601d44e1125e4f11f171db818)] -> css selector: html]
Session ID: c3a6b1d601d44e1125e4f11f171db818
	at jdk.internal.reflect.GeneratedConstructorAccessor50.newInstance(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
	at org.openqa.selenium.remote.ErrorCodec.decode(ErrorCodec.java:167)
	at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:138)
	at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:50)
	at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:215)
	at org.openqa.selenium.remote.service.DriverCommandExecutor.invokeExecute(DriverCommandExecutor.java:216)
	at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:174)
	at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:545)
	at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:223)
	at org.openqa.selenium.remote.RemoteWebElement.getText(RemoteWebElement.java:191)
	at jdk.internal.reflect.GeneratedMethodAccessor10.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:569)
	at org.openqa.selenium.support.decorators.WebDriverDecorator.call(WebDriverDecorator.java:315)
	at org.openqa.selenium.support.decorators.DefaultDecorated.call(DefaultDecorated.java:48)
	at org.openqa.selenium.support.decorators.WebDriverDecorator.lambda$createProxyFactory$3(WebDriverDecorator.java:405)
	at net.bytebuddy.renamed.java.lang.Object$ByteBuddy$s735gCXr.getText(Unknown Source)
	at org.jenkinsci.test.acceptance.po.CapybaraPortingLayerImpl.getPageContent(CapybaraPortingLayerImpl.java:592)
	at org.jenkinsci.test.acceptance.Matchers$1.matchesSafely(Matchers.java:43)
	at org.jenkinsci.test.acceptance.Matchers$1.matchesSafely(Matchers.java:37)
	at org.hamcrest.TypeSafeMatcher.matches(TypeSafeMatcher.java:65)
	at org.hamcrest.core.IsNot.matches(IsNot.java:25)
	at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:12)
	at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:8)
	at org.jenkinsci.test.acceptance.plugins.credentials.CredentialsPage.create(CredentialsPage.java:60)

Anything else?

I am going to try reverting to an older version of the credentials plugin to see if that helps.

Are you interested in contributing a fix?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions