SeleniumHQ / selenium

A browser automation framework and ecosystem.
https://selenium.dev
Apache License 2.0
30.7k stars 8.19k forks source link

[🐛 Bug]: Most of the test cases are failing #13493

Closed phimasai-winfo closed 9 months ago

phimasai-winfo commented 9 months ago

What happened?

I recently upgraded ubuntu 18 to 22 and chromdriver from 87.0.4280.88 to 114 , From that time more than half of the test cases are getting failed

How can we reproduce the issue?

WebDriver driver = null;
String os = System.getProperty("os.name").toLowerCase();
os = operatingSystem == null ? os : operatingSystem;
if (BrowserConstants.CHROME.getValue().equalsIgnoreCase(fetchConfigVO.getBROWSER())) {
            System.setProperty(DriverConstants.CHROME_DRIVER.getValue(), fetchConfigVO.getCHROME_DRIVER_PATH());
            Map<String, Object> prefs = new HashMap<>();
            ChromeOptions options = new ChromeOptions();
            MutableCapabilities cap = new MutableCapabilities();
            if (!os.contains("win")) {
                prefs.put(BrowserConstants.DOWNLOAD_DEFAULT_DIRECTORY.getValue(), fetchConfigVO.getEXCEL_DOWNLOAD_FILE_PATH());
                logger.info("Script Running on  Windows location");
                options.setBinary("/Program Files/Google/Chrome/Application/chrome.exe");
                cap.setCapability(CapabilityType.PLATFORM_NAME, Platform.WINDOWS);
            } else  {
                prefs.put(BrowserConstants.DOWNLOAD_DEFAULT_DIRECTORY.getValue(), fetchConfigVO.getDOWNLOD_FILE_PATH());
                logger.info("Script Running on Linux Location");
                options.setBinary("/usr/bin/google-chrome");
                cap.setCapability(CapabilityType.PLATFORM_NAME, Platform.LINUX);
            }
            options.addArguments(BrowserConstants.START_MAXIMIZED.getValue());
            options.addArguments(BrowserConstants.NO_SENDBOX.getValue());
            options.addArguments(BrowserConstants.ENABLE_AUTOMATION.getValue());
            options.addArguments(BrowserConstants.TEST_TYPE.getValue());
            options.addArguments(BrowserConstants.DISABLE_INFOBARS.getValue());
            options.setExperimentalOption("prefs", 
                     ImmutableMap.of("profile.default_content_setting_values.notifications", 0));
            options.setExperimentalOption("prefs", prefs);
            options.setUnhandledPromptBehaviour(UnexpectedAlertBehaviour.IGNORE);
            cap.setCapability(ChromeOptions.CAPABILITY, options);
            cap.merge(options);

            // String hubUrl = "http://localhost:4444";
            try {
                driver = new RemoteWebDriver(new URL(hubUrl), cap);
                logger.info("driver init success");
            } catch (Exception  e){
                logger.error("failed initiate the driver");
                e.printStackTrace();driver = new RemoteWebDriver(new URL(hubUrl), cap);
            logger.info("driver init success");
            }
            // driver = new RemoteWebDriver(new URL(hubUrl), cap);
            // logger.info("driver init success");
        }

Relevant log output

Error in execution: Message: Could not start a new session. Could not start a new session. Unable to obtain: Capabilities {browserName: chrome, goog:chromeOptions: {args: [], binary: /usr/bin/google-chrome, extensions: []}, pageLoadStrategy: normal, platformName: linux}, error Failed to parse json output, executed: [--browser, chrome, --output, json, --browser-path, /usr/bin/google-chrome]

Build info: version: '4.15.0', revision: '1d14b5521b'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.15.0-1045-oracle', java.version: '17.0.7'
Driver info: driver.version: unknown
Host info: host: 'watsdev', ip: '127.0.1.1'
Build info: version: '4.15.0', revision: '1d14b5521b'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.15.0-1045-oracle', java.version: '17.0.7'
Driver info: driver.version: unknown
Build info: version: '4.15.0', revision: '1d14b5521b'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.4.17-2136.321.4.el7uek.x86_64', java.version: '17.0.5'
Driver info: driver.version: unknown
Stacktrace:
    at org.openqa.selenium.grid.node.remote.RemoteNode.newSession (RemoteNode.java:151)
    at org.openqa.selenium.grid.distributor.local.LocalDistributor.startSession (LocalDistributor.java:645)
    at org.openqa.selenium.grid.distributor.local.LocalDistributor.newSession (LocalDistributor.java:564)
    at org.openqa.selenium.grid.distributor.local.LocalDistributor$NewSessionRunnable.handleNewSessionRequest (LocalDistributor.java:824)
    at org.openqa.selenium.grid.distributor.local.LocalDistributor$NewSessionRunnable.lambda$run$1 (LocalDistributor.java:784)
    at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1136)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:635)
    at java.lang.Thread.run (Thread.java:833)

Operating System

Ubuntu

Selenium version

4.5.3

What are the browser(s) and version(s) where you see this issue?

chrome 114, chrome 120

What are the browser driver(s) and version(s) where you see this issue?

chrome 114, chrome 120

Are you using Selenium Grid?

4.4

github-actions[bot] commented 9 months ago

@phimasai-winfo, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

diemol commented 9 months ago

You need to upgrade to the latest Selenium to have things working properly. If the issue persists after upgrading, please open a new issue.

phimasai-winfo commented 9 months ago

@diemol i created a grid in docker, same code i am not getting any error with that grid

diemol commented 9 months ago

You need to update the client side from 4.5.3 to 4.17.0

github-actions[bot] commented 8 months ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.