Skip to content

[🐛 Bug]: Selenium 4.33 - Actions class does not work in headless mode #15992

@SeleniumNinja

Description

@SeleniumNinja

Description

The following code does not work in headless mode on jenkins pipeline (either on Selenium version 4.34). However locally in non- headless it works fine.

actions.keyDown(Keys.LEFT_CONTROL)
.click(DRIVER.findElement(By.xpath(xpathToElement)))
.keyUp(Keys.LEFT_CONTROL).build().perform();
options.addArguments("--enable-automation");
options.addArguments("--disable-extensions");
options.addArguments("--window-size=1920,1080");
options.addArguments("--headless=new");
options.addArguments("--disable-dev-shm-usage");
options.addArguments("--no-sandbox");
options.addArguments("--disable-gpu");

Error:

org.openqa.selenium.TimeoutException: java.util.concurrent.TimeoutException
Build info: version: '4.33.0', revision: '2c6aaad03a'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '4.18', java.version: '17.0.15'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Command: [session id number here, actions {actions=[org.openqa.selenium.interactions.Sequence@62c42a3]}]
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 137.0.7151.68, chrome: {chromedriverVersion: 137.0.7151.119 (e0ac9d12dff..., userDataDir: /tmp/.org.chromium.Chromium...}, fedcm:accounts: true, goog:chromeOptions: {debuggerAddress: localhost:34999}, networkConnectionEnabled: false, pageLoadStrategy: normal, platformName: linux, proxy: Proxy(), se:cdp: ws://localhost:34999/devtoo..., se:cdpVersion: 137.0.7151.68, 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}
Session ID: session id number here
	at org.openqa.selenium.remote.http.jdk.JdkHttpClient.execute(JdkHttpClient.java:427)
	at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:212)
	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:544)
	at org.openqa.selenium.remote.RemoteWebDriver.perform(RemoteWebDriver.java:630)
	at org.openqa.selenium.interactions.Actions$BuiltAction.perform(Actions.java:616)
	at ...
	
Caused by: java.util.concurrent.TimeoutException
	at java.base/java.util.concurrent.CompletableFuture$Timeout.run(CompletableFuture.java:2874)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:840)

Reproducible Code

The following code does not work in headless mode, however it works on local computer in non headless mode: 

actions.keyDown(Keys.LEFT_CONTROL)
.click(DRIVER.findElement(By.xpath(xpathToElement)))
.keyUp(Keys.LEFT_CONTROL).build().perform();

It does not work either on Selenium 4.34

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions