Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[🐛 Bug]: Unable to trigger the Test with specific Browser version in Selenium Grid #14788

Open
arunkumarr88 opened this issue Nov 22, 2024 · 1 comment

Comments

@arunkumarr88
Copy link

What happened?

Im using selenium 4.26 with openJdk 11.0.2. I have a selenium grid with 10 machines. When i try to run the test with specific browser version, the tests goes in queue and fails.

Refer below grid ui image where thetest goes in queue.
image

How can we reproduce the issue?

public RemoteWebDriver startGrid(String browser) throws Exception {
		log.info("Going to setup grid...");
		int resolutionWidth;
		int resolutionHeight;
		String[] resolution = ReadPropertyFile.getInstance().getPropertyValue("resolution").split(",");
		String headlessFlag = ReadPropertyFile.getInstance().getPropertyValue("headlessFlag");
		resolutionWidth = Integer.parseInt(resolution[0]);
		resolutionHeight = Integer.parseInt(resolution[1]);
		MutableCapabilities cap = new MutableCapabilities();
		cap.setCapability("platformName", "ANY");
		if (browser.equalsIgnoreCase(BrowserConstants.CHROME_BROWSER)) {
			cap.setCapability("browserName", BrowserConstants.CHROME_BROWSER);
			ChromeOptions options = new ChromeOptions();
			**options.setBrowserVersion(ReadPropertyFile.getInstance()
	    	        .getPropertyValue("browserVersion"));**
			if (headlessFlag.equalsIgnoreCase("true")) {
				options.addArguments("--headless=new");
			}
			options.addArguments("--incognito");
			Map<String, Object> profile = new HashMap<>();
			Map<String, Object> prefs = new HashMap<>();
			prefs.put("profile", profile);
			prefs.put("credentials_enable_service", false);
			prefs.put("profile.password_manager_enabled", false);			
			options.setExperimentalOption("prefs", prefs);
			options.addArguments("--ignore-ssl-errors=yes");
			options.addArguments("--ignore-certificate-errors");
			options.addArguments("--disable-search-engine-choice-screen");
			options.addArguments("--disable-features=OptimizationGuideModelDownloading,OptimizationHintsFetching,OptimizationTargetPrediction,OptimizationHints");			
			options.setExperimentalOption("excludeSwitches", Collections.singletonList("enable-automation"));
			options.setExperimentalOption("useAutomationExtension", false);
			options.setCapability("se:name", getTestcaseName());
			options = options.merge(cap);
			log.info("Going to get Driver instance from thread local class...");
			
			RemoteCustomDriver.getInstance().setRemotedriver(new RemoteWebDriver(new URL(getHubUrl()), options));			 
			SessionId sessionId = (RemoteCustomDriver.getInstance().getRemotedriver()).getSessionId();

			nodeIp = getNodeIp(sessionId);
			RemoteCustomDriver.getInstance().getRemotedriver().manage().deleteAllCookies();
			RemoteCustomDriver.getInstance().getRemotedriver().navigate().to(getUrl());
		} else if (browser.equalsIgnoreCase(BrowserConstants.FIREFOX_BROWSER)) {
			cap.setCapability("browserName", BrowserConstants.FIREFOX_BROWSER);
			FirefoxOptions options = new FirefoxOptions();
			**options.setBrowserVersion(ReadPropertyFile.getInstance()
	    	        .getPropertyValue("browserVersion"));**
			if (headlessFlag.equalsIgnoreCase("true")) {
				options.addArguments("--headless=new");
			}
			options.addArguments("-private");
			options.merge(cap);
			log.info("Going to get Driver instance from thread local class...");
			RemoteCustomDriver.getInstance().setRemotedriver(new RemoteWebDriver(new URL(getHubUrl()), options));
			RemoteCustomDriver.getInstance().getRemotedriver().manage().deleteAllCookies();
			RemoteCustomDriver.getInstance().getRemotedriver().navigate().to(getUrl());
		} else if (browser.equalsIgnoreCase(BrowserConstants.EDGE_BROWSER)) {
			cap.setCapability("browserName", BrowserConstants.EDGE_BROWSER);
			EdgeOptions options = new EdgeOptions();
			**options.setBrowserVersion(ReadPropertyFile.getInstance()
	    	        .getPropertyValue("browserVersion"));**
			if (headlessFlag.equalsIgnoreCase("true")) {
				options.addArguments("--headless=new");
			}
			options.addArguments("--ignore-ssl-errors=yes");
			options.addArguments("--ignore-certificate-errors");
			options.addArguments("--disable-search-engine-choice-screen");
			options.addArguments("--disable-features=OptimizationGuideModelDownloading,OptimizationHintsFetching,OptimizationTargetPrediction,OptimizationHints");	
			options.merge(cap);
			log.info("Going to get Driver instance from thread local class...");
			RemoteCustomDriver.getInstance().setRemotedriver(new RemoteWebDriver(new URL(getHubUrl()), options));
			SessionId sessionId = (RemoteCustomDriver.getInstance().getRemotedriver()).getSessionId();

			nodeIp = getNodeIp(sessionId);
			RemoteCustomDriver.getInstance().getRemotedriver().manage().deleteAllCookies();
			RemoteCustomDriver.getInstance().getRemotedriver().navigate().to(getUrl());
		} 
		RemoteCustomDriver.getInstance().getRemotedriver().navigate().refresh();
		RemoteCustomDriver.getInstance().getRemotedriver().manage().window()
				.setSize(new Dimension(resolutionWidth, resolutionHeight));
		RemoteCustomDriver.getInstance().getRemotedriver().manage().timeouts().pageLoadTimeout(Duration.ofSeconds(30));
		RemoteCustomDriver.getInstance().getRemotedriver().manage().timeouts().scriptTimeout(Duration.ofMinutes(2));
		RemoteCustomDriver.getInstance().getRemotedriver().manage().timeouts().implicitlyWait(Duration.ofSeconds(30));
		String version = RemoteCustomDriver.getInstance().getRemotedriver().getCapabilities().toString();
		System.setProperty("Browser/Driver Versions", version);
		return RemoteCustomDriver.getInstance().getRemotedriver();
	}

Below are the commands that i'm using to start the server.
**For Hub :**   java -jar selenium-server-4.26.0.jar hub --session-request-timeout 1300  --log-level "info" --log C:\Selenium4.23GridHub\hublog.log
**For Node :**  java -jar selenium-server-4.26.0.jar node --session-timeout 1000 --max-sessions 4 --selenium-manager true --detect-drivers true --publish-events tcp://10.50.12.39:4442 --subscribe-events tcp://10.50.12.39:4443 --log-level "info" --log C:\Selenium4.23GridNode\nodelog.log

Relevant log output

Session Not Created due to: org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure. 
Host info: host: 'PRONVDC048', ip: '192.168.64.145'

Operating System

Windows 10

Selenium version

4.26

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

130

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

130

Are you using Selenium Grid?

4.26

Copy link

@arunkumarr88, 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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant