-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
Closed
Labels
I-questionApplied to questions. Issues should be closed and send the user to community resources.Applied to questions. Issues should be closed and send the user to community resources.
Description
What happened?
How do you interact with the browser's developer tools during automation tests running in a distributed Selenium Grid environment using Docker?
How can we reproduce the issue?
if (REMOTE.equalsIgnoreCase("yes")) {
// Configure for Selenium Grid
if (BROWSER.equalsIgnoreCase("chrome")) {
ChromeOptions options = new ChromeOptions();
options.addArguments("--remote-debugging-port=9222");
driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), options);
if (driver instanceof ChromeDriver) {
ChromeDriver chromeDriver = (ChromeDriver) driver;
DevTools devTools = chromeDriver.getDevTools();
devTools.createSession(); // Create a DevTools session
// Enable the Network domain to capture network events
devTools.send(org.openqa.selenium.devtools.v85.network.Network.enable(Optional.of(1000000), Optional.of(1000000), Optional.of(1000000)));
// Capture network responses
devTools.addListener(org.openqa.selenium.devtools.v85.network.Network.responseReceived(), response -> {
String url = response.getResponse().getUrl();
int statusCode = response.getResponse().getStatus();
System.out.println("URL: " + url + " | Status Code: " + statusCode);
if (statusCode == 200) {
System.out.println("Network request to " + url + " succeeded with status 200 OK.");
} else {
System.out.println("Network request to " + url + " failed with status " + statusCode);
}
});
} else {
System.out.println("Driver is not an instance of ChromeDriver.");
}
} else if (BROWSER.equalsIgnoreCase("edge")) {
EdgeOptions options1 = new EdgeOptions();
options1.addArguments("--remote-debugging-port=9222");
driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), options1);
if (driver instanceof EdgeDriver) {
EdgeDriver edgeDriver = (EdgeDriver) driver;
DevTools devTools = edgeDriver.getDevTools();
devTools.createSession();
devTools.send(Network.enable(Optional.of(1000000), Optional.of(1000000), Optional.of(1000000)));
devTools.addListener(Network.responseReceived(), response -> {
String url = response.getResponse().getUrl();
int statusCode = response.getResponse().getStatus();
System.out.println("URL: " + url + " | Status Code: " + statusCode);
if (statusCode == 200) {
System.out.println("Network request to " + url + " succeeded with status 200 OK.");
} else {
System.out.println("Network request to " + url + " failed with status " + statusCode);
}
});
} else {
System.out.println("DevTools is only supported for EdgeDriver.");
}
} else if (BROWSER.equalsIgnoreCase("firefox")) {
EdgeOptions options2 = new EdgeOptions();
driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), options2);
} else {
System.out.println("Invalid browser specified for remote execution.");
return;
}
System.out.println("===========Browser Launch on Selenium Grid Successfully===========");
}Relevant log output
[RemoteTestNG] detected TestNG version 7.4.0
Jan 06, 2025 12:32:25 AM org.openqa.selenium.remote.tracing.opentelemetry.OpenTelemetryTracer createTracer
INFO: Using OpenTelemetry for tracing
DevTools is only supported for EdgeDriver.
===========Browser Launch on Selenium Grid Successfully===========
=============login sucessfull===========
C:\Users\SAIKAT~1\AppData\Local\Temp\screenshot3193501337629602552.png--------------------------------------------------------
log4j:WARN No appenders could be found for logger (freemarker.cache).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
C:\Users\SaikatDas\OneDrive - RISKSUCCESS PRIVATE LIMITED\Documents\upgradtion\com.framework.seleniumiRM\errorshots\testCanDoSummary2025-01-06T00-33-52.602905900.png
==========sign out sucessfull==========
=====Browser close sucessfull============
FAILED: testCanDoSummary
org.openqa.selenium.ElementNotInteractableException: element not interactable
(Session info: MicrosoftEdge=131.0.2903.70)
Build info: version: '4.27.0', revision: 'd6e718d134'
System info: os.name: 'Windows 11', os.arch: 'amd64', os.version: '10.0', java.version: '21.0.1'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
Command: [282db9fc622f8fcbd0bdd77b48f3538f, sendKeysToElement {value=[Ljava.lang.CharSequence;@27e32fe4, id=f.B047E46FF631674912F088DA83B88B3C.d.25616857EB5F5254C2DCBF98CDCF1ABD.e.64}]
Capabilities {acceptInsecureCerts: false, browserName: MicrosoftEdge, browserVersion: 131.0.2903.70, fedcm:accounts: true, ms:edgeOptions: {debuggerAddress: localhost:9222}, msedge: {msedgedriverVersion: 131.0.2903.52 (bf56be9460d2..., userDataDir: /tmp/.com.microsoft.Edge.I1...}, networkConnectionEnabled: false, pageLoadStrategy: normal, platformName: linux, proxy: Proxy(), se:bidiEnabled: false, se:cdp: ws://172.18.0.4:4444/sessio..., se:cdpVersion: 131.0.2903.70, se:containerName: , se:noVncPort: 7900, se:vnc: ws://172.18.0.4:4444/sessio..., se:vncEnabled: true, se:vncLocalAddress: ws://172.18.0.4:7900, 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: [[RemoteWebDriver: MicrosoftEdge on linux (282db9fc622f8fcbd0bdd77b48f3538f)]Operating System
Windows 11
Selenium version
4.27.0
What are the browser(s) and version(s) where you see this issue?
Chrome Lates, Edege latest
What are the browser driver(s) and version(s) where you see this issue?
all are in latest stable version
Are you using Selenium Grid?
yes-4.27.0
Metadata
Metadata
Assignees
Labels
I-questionApplied to questions. Issues should be closed and send the user to community resources.Applied to questions. Issues should be closed and send the user to community resources.