-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
Closed
Labels
G-chromedriverRequires fixes in ChromeDriverRequires fixes in ChromeDriverI-defectSomething is not working as intendedSomething is not working as intended
Description
What happened?
Steps:
- Navigate to the web application.
- Click on Print option
Expected Result:
It should display the Print Preview dialog
Actual Result:
Print preview dialog box is not displayed.
Code:
ChromeOptions options = new ChromeOptions();
if(headless)
{
// Window size increased to overcome the problem of overlapping success messages on transition buttons.
// options.addArguments("--headless", "--disable-gpu", "--window-size=1000,650");
options.addArguments("--headless=new", "--disable-gpu", "--window-size=1920,1200", "--start-maximized", "--incognito",
"disable-features=NetworkServiceInProcess", "--ignore-certificate-errors");
}
// Forcing the browser to download the artifacts directly to the tempdir.
HashMap<String, Object> chromePref = new HashMap<>();
chromePref.put("download.default_directory", System.getProperty("java.io.tmpdir"));
chromePref.put("profile.default_content_settings.popups", 0);
options.setExperimentalOption("prefs", chromePref);
options.setExperimentalOption("excludeSwitches", Arrays.asList("disable-popup-blocking"));
//Handle SSL certificate issue in the browser.
options.setAcceptInsecureCerts(true);
options.setProxy(proxy());
// Open the browser
WebDriver driver = new ChromeDriver(options);
// Below code is to download the file in headless mode
((ChromeDriver)driver).executeCdpCommand("Page.setDownloadBehavior", Map.of("behavior", "allow", "downloadPath", System.getProperty("java.io.tmpdir")));
// Maximize the browser only in windows machine
if (FileOperations.isWindows())
driver.manage().window().maximize();
LOG.info("Browser Version: " + ((RemoteWebDriver)driver).getCapabilities().getBrowserVersion());
return driver;
gadgetPage.moveToElement("Gadget.btnGadgetMenu").click().perform();
String parentWinHdl = driver.getWindowHandle();
// Clicking on the menu option-Print.
gadgetPage.gadgetMenuOperations("Print");
Set<String>s=driver.getWindowHandles();
Iterator<String> I1= s.iterator();
while(I1.hasNext())
{
String childWindow=I1.next();
if(!parentWinHdl.equals(childWindow))
driver.switchTo().window(childWindow);
}
((JavascriptExecutor)driver).executeScript("document.querySelector(\"body > print-preview-app\").shadowRoot.querySelector(\"#sidebar\").shadowRoot.querySelector(\"print-preview-button-strip\").shadowRoot.querySelector(\"div > cr-button.cancel-button\").click();");
Ses the below attachments.
Before clicking on Print:

After clicking on Print:

How can we reproduce the issue?
Since the application is under a corporate network, hence I cannot give the URL.Relevant log output
org.openqa.selenium.JavascriptException: javascript error: Cannot read properties of null (reading 'shadowRoot')
(Session info: chrome=131.0.6778.205)
Build info: version: '4.27.0', revision: 'd6e718d134'
System info: os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '11.0.19'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Command: [82c9f1ae621aed6973ac666560e17918, executeScript {args=[], script=document.querySelector("body > print-preview-app").shadowRoot.querySelector("#sidebar").shadowRoot.querySelector("print-preview-button-strip").shadowRoot.querySelector("div > cr-button.cancel-button").click();}]
Capabilities {acceptInsecureCerts: true, browserName: chrome, browserVersion: 131.0.6778.205, chrome: {chromedriverVersion: 131.0.6778.204 (52183f9e99a..., userDataDir: C:\WINDOWS\SystemTemp\scope...}, fedcm:accounts: true, goog:chromeOptions: {debuggerAddress: localhost:50493}, networkConnectionEnabled: false, pageLoadStrategy: normal, platformName: windows, proxy: Proxy(manual, http=proxy.ro..., se:cdp: ws://localhost:50493/devtoo..., se:cdpVersion: 131.0.6778.205, 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: 82c9f1ae621aed6973ac666560e17918
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
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:190)
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.RemoteWebDriver.executeScript(RemoteWebDriver.java:476)
at com.rc.alm.it.tests.common.jiraGadgets.GadgetMenuVerification.gadgetMenuOptionsVerification(GadgetMenuVerification.java:116)
at com.rc.alm.it.tests.common.jiraGadgets.JiraApprovalSuccessRateGadget.verificationOFGadgetMenuOptions(JiraApprovalSuccessRateGadget.java:507)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.testng.internal.invokers.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:141)
at org.testng.internal.invokers.TestInvoker.invokeMethod(TestInvoker.java:686)
at org.testng.internal.invokers.TestInvoker.invokeTestMethod(TestInvoker.java:230)
at org.testng.internal.invokers.MethodRunner.runInSequence(MethodRunner.java:63)
at org.testng.internal.invokers.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:992)
at org.testng.internal.invokers.TestInvoker.invokeTestMethods(TestInvoker.java:203)
at org.testng.internal.invokers.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:154)
at org.testng.internal.invokers.TestMethodWorker.run(TestMethodWorker.java:134)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
at org.testng.TestRunner.privateRun(TestRunner.java:739)
at org.testng.TestRunner.run(TestRunner.java:614)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:421)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:413)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:373)
at org.testng.SuiteRunner.run(SuiteRunner.java:312)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:95)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1274)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1208)
at org.testng.TestNG.runSuites(TestNG.java:1112)
at org.testng.TestNG.run(TestNG.java:1079)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:115)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:293)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:91)Operating System
Windows, Linux
Selenium version
Selenium version 4.27.0
What are the browser(s) and version(s) where you see this issue?
Chrome version 131.0.6778.205
What are the browser driver(s) and version(s) where you see this issue?
Same as browser version
Are you using Selenium Grid?
No
Metadata
Metadata
Assignees
Labels
G-chromedriverRequires fixes in ChromeDriverRequires fixes in ChromeDriverI-defectSomething is not working as intendedSomething is not working as intended