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]: java.lang.IllegalArgumentException: Value must be set #13937

Closed
joerg1985 opened this issue May 14, 2024 · 7 comments
Closed

[🐛 Bug]: java.lang.IllegalArgumentException: Value must be set #13937

joerg1985 opened this issue May 14, 2024 · 7 comments

Comments

@joerg1985
Copy link
Member

What happened?

I can see java.lang.IllegalArgumentException errors in the log of the nightly builds, but this should also happen with 4.20.0.

Setting a null value is not allowed: https://github.com/SeleniumHQ/selenium/blob/trunk/java/src/org/openqa/selenium/grid/node/config/DriverServiceSessionFactory.java#L331

How can we reproduce the issue?

org.openqa.selenium.grid.Bootstrap.main("standalone --host 127.0.0.1 --port 4567".split(" "));

Thread.sleep(Duration.ofSeconds(20));

var driver = new RemoteWebDriver(URI.create("http://127.0.0.1:4567/wd/hub").toURL(), new ChromeOptions());

Relevant log output

java.lang.IllegalArgumentException: Value must be set
	at org.openqa.selenium.internal.Require.nonNull(Require.java:61)
	at org.openqa.selenium.ImmutableCapabilities.<init>(ImmutableCapabilities.java:39)
	at org.openqa.selenium.PersistentCapabilities.setCapability(PersistentCapabilities.java:54)
	at org.openqa.selenium.grid.node.config.DriverServiceSessionFactory.setBrowserBinary(DriverServiceSessionFactory.java:331)
	at org.openqa.selenium.grid.node.config.DriverServiceSessionFactory.apply(DriverServiceSessionFactory.java:136)
	at org.openqa.selenium.grid.node.config.DriverServiceSessionFactory.apply(DriverServiceSessionFactory.java:71)
	at org.openqa.selenium.grid.node.local.SessionSlot.apply(SessionSlot.java:147)
	at org.openqa.selenium.grid.node.local.LocalNode.newSession(LocalNode.java:469)
	at org.openqa.selenium.grid.distributor.local.LocalDistributor.startSession(LocalDistributor.java:652)
	at org.openqa.selenium.grid.distributor.local.LocalDistributor.newSession(LocalDistributor.java:571)
	at org.openqa.selenium.grid.distributor.local.LocalDistributor$NewSessionRunnable.handleNewSessionRequest(LocalDistributor.java:831)
	at org.openqa.selenium.grid.distributor.local.LocalDistributor$NewSessionRunnable.lambda$run$1(LocalDistributor.java:791)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1583)

Operating System

Win 10 x64

Selenium version

4.21.0-SNATSHOT

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

Chrome 124

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

Chromedriver 124

Are you using Selenium Grid?

4.21.0-SNATSHOT

Copy link

@joerg1985, 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
Copy link
Member

diemol commented May 14, 2024

I tried to add more logging to understand the missing value. Is that the whole stacktrace? It should have logged more values.

@joerg1985
Copy link
Member Author

@joerg1985
Copy link
Member Author

@diemol i think the value should be removed from the caps here, this would work with a MutableCapabilities link but the PersistentCapabilities do not support removing caps.

@diemol diemol added this to the 4.21 milestone May 15, 2024
@diemol diemol closed this as completed in 9f650fd May 15, 2024
@sujeetneha
Copy link

getting the same error
:- java.lang.IllegalArgumentException: Input must be set
at org.openqa.selenium.internal.Require.nonNull(Require.java:60)
at org.openqa.selenium.support.ui.FluentWait.(FluentWait.java:93)
at org.openqa.selenium.support.ui.WebDriverWait.(WebDriverWait.java:74)
at org.openqa.selenium.support.ui.WebDriverWait.(WebDriverWait.java:43)
at com.mdm.seqrite.utils.Waits.waitForPageLoaded(Waits.java:25)
at com.mdm.seqrite.utils.ORReader.is_element_present(ORReader.java:105)
at com.mdm.seqrite.appmodule.AppConfig.checkByAddingAppConfig(AppConfig.java:70)

here are my setup file code:-

package com.mdm.seqrite.utils;

import com.google.common.collect.ImmutableMap;
import com.mdm.seqrite.constants.Constants;

import io.appium.java_client.MobileElement;
import io.appium.java_client.android.AndroidDriver;
import io.github.bonigarcia.wdm.WebDriverManager;
import seqrite.mdm.client.utils.ClientAppUtils;

import org.testng.annotations.BeforeMethod;

import java.io.IOException;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.TimeUnit;

import org.apache.log4j.xml.DOMConfigurator;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebDriverException;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeDriverService;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.ITestResult;
import org.testng.annotations.AfterMethod;

import org.testng.annotations.BeforeSuite;
import org.testng.annotations.BeforeTest;

public class SetUp {

	public static ConfigReader configReader = null;
	private String browserName = null;
	protected static WebDriver driver = null;
	public 	static ORReader OR = null;
	public static ClientAppUtils clientApp = null;
	public 	static AndroidORReader AOR = null;
	public static ExcelUtils excelUtils;
	public static AndroidDriver<MobileElement> androidDriver;
	
	public static String androidDevice = null;
	public static String androidVersion = null;
	public static String appPackageName = null;
	public static String androidServer = null;
	public static  String client_automation_flag = null;

// @BeforeTest(alwaysRun = true)
// public void initializeBrowser() throws Exception {
// if(configReader == null) {
// configReader = new ConfigReader();
// client_automation_flag = configReader.get_Client_Automation_Flag();
// Log.info("Client Automation required ? ----> "+client_automation_flag );
// }
// if(OR == null) {
// OR = new ORReader();
// }
// excelUtils = new ExcelUtils();
// clientApp = new ClientAppUtils();
// initialization();
// Login.loginIntoMDM();
// Waits.waitForPageLoaded(Constants.WAIT_INTERVAL);
// Waits.waitUntilJqueryIsDone(Constants.WAIT_INTERVAL);
// }

@BeforeMethod(alwaysRun = true)

public void initializeMethod(Method method) throws Exception {
if(configReader == null) {
configReader = new ConfigReader();
client_automation_flag = configReader.get_Client_Automation_Flag();
Log.info("Client Automation required ? ----> "+client_automation_flag );
}
if(OR == null) {
OR = new ORReader();
}
excelUtils = new ExcelUtils();
clientApp = new ClientAppUtils();
initialization();
Log.info("**********************************************************");
Log.info("**********TEST CASE :"+method.getName()+"*****************" );

}

@AfterMethod(alwaysRun = true)
public void endMethod(ITestResult result) throws IOException {
result.getTestContext().getSkippedTests().removeResult(result.getMethod());
Process exec = Runtime.getRuntime().exec("taskkill /F /IM chromedriver.exe /t");
exec.destroy();
exec = Runtime.getRuntime().exec("taskkill /F /IM chrome.exe /t");
exec.destroy();
//driver.quit();
Log.info("***************** Test Ended *****************");
Log.info("**********************************************************");
}

// @AfterTest(alwaysRun = true)
// public void endProcess() throws IOException {
//
// Process exec = Runtime.getRuntime().exec("taskkill /F /IM chromedriver.exe /t");
// exec.destroy();
// exec = Runtime.getRuntime().exec("taskkill /F /IM chrome.exe /t");
// exec.destroy();
// driver.quit();
// }

@BeforeSuite(alwaysRun = true)
public void onStart() {
DOMConfigurator.configure(System.getProperty("user.dir")+Constants.LOG4J_CONFIGURATION_FILE);
}

public void initialization() throws IOException {

  browserName = configReader.getbrowser();
  
  if(browserName!=null) {
	  switch (browserName) {
	  case "Chrome":
		  try {
			  
			  ChromeOptions browserName = new ChromeOptions();
			  //browserName.setBinary("C:\\Users\\sujeet.gawande\\chrome-win64\\chrome.exe");
			  //WebDriverManager.chromedriver().clearCache();
			 //WebDriverManager.chromedriver().clearDriverCache().setup();
			  //WebDriverManager.chromedriver().setup();
			  WebDriver driver = new ChromeDriver(browserName);
			  
			  driver.get("https://www.google.com");
				driver.manage().window().maximize();

			  
			  
			//System.setProperty(ChromeDriverService.CHROME_DRIVER_SILENT_OUTPUT_PROPERTY,"true");
			 // WebDriverManager.chromedriver().setup();
			 
			 // driver = new ChromeDriver();
			  
			  //Log.info("browserName "+browserName);
			  //driver.manage().window().maximize();

		  }catch (WebDriverException e) {
			  	/*Process exec = Runtime.getRuntime().exec("taskkill /F /IM chromedriver.exe");
				exec.destroy();
				exec = Runtime.getRuntime().exec("taskkill /F /IM chrome.exe");
				exec.destroy();
				WebDriverManager.chromedriver().setup();
					 
				driver = new ChromeDriver();
				driver.manage().window().maximize();*/
			 
		  }
	  }

  }

}

public static void launch_mdm_client(String appPackage, String appActivity) {
//if(client_automation_flag.equalsIgnoreCase("Yes")) {
AOR = new AndroidORReader();

		androidDevice = configReader.get_Device_Name();
		androidVersion = configReader.get_Android_Version();

		androidServer = configReader.get_Android_URL();
	 

	DesiredCapabilities capabilities = new DesiredCapabilities();
	
	capabilities.setCapability("appium:chromeOptions", ImmutableMap.of("w3c", false));
	capabilities.setCapability("deviceName", androidDevice);
	
	capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
	//capabilities.setCapability(CapabilityType.VERSION, androidVersion);

	capabilities.setCapability("platformName", "Android");

	capabilities.setCapability("noReset", "true");
	capabilities.setCapability("fullReset", "false");

	capabilities.setCapability("appPackage", appPackage);
	capabilities.setCapability("appActivity", appActivity);
	capabilities.setCapability("automationName", "UiAutomator1");
	
	try {
		androidDriver = new AndroidDriver<MobileElement>(new URL(androidServer), capabilities);
		
		Log.info("App launched");
	} catch (MalformedURLException e) {

		e.printStackTrace();
	}

	androidDriver.manage().timeouts().implicitlyWait(80, TimeUnit.SECONDS);
	Log.info("Client Application Launch Successfully");
	
//}

}

public static void launchChrome() {
androidDevice = configReader.get_Device_Name();
androidVersion = configReader.get_Android_Version();
androidServer = configReader.get_Android_URL();

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("appium:chromeOptions", ImmutableMap.of("w3c", false));
capabilities.setCapability("deviceName", androidDevice);

capabilities.setCapability(CapabilityType.BROWSER_NAME, "Chrome");
//capabilities.setCapability(CapabilityType.VERSION, androidVersion);

capabilities.setCapability("platformName", "Android");
try {
	androidDriver = new AndroidDriver<MobileElement>(new URL(androidServer), capabilities);
	Log.info("App launched");
} catch (MalformedURLException e) {

	e.printStackTrace();
}

androidDriver.manage().timeouts().implicitlyWait(80, TimeUnit.SECONDS);
Log.info("andriod driver Launched Successfully");

}

here are my POM file code:-

4.0.0

com
MDM
0.0.1-SNAPSHOT
jar

mdm.seqrite
http://maven.apache.org

UTF-8 org.seleniumhq.selenium selenium-java 4.15.0
	<dependency>
		<groupId>org.testng</groupId>
		<artifactId>testng</artifactId>
		<!--version>6.14.3</version> -->
		<version>7.8.0</version>
		<scope>test</scope>
	</dependency>

<dependency>

org.seleniumhq.selenium
selenium-chrome-driver
4.16.1

	<dependency>
		 <groupId>mysql</groupId>
		<artifactId>mysql-connector-java</artifactId>
		<version>8.0.21</version>
	</dependency>
	<dependency>
		<groupId>commons-io</groupId>
		<artifactId>commons-io</artifactId>
		<version>2.15.0</version>
	</dependency>
org.apache.poi poi-ooxml 4.0.1
<dependency>
		<groupId>com.aventstack</groupId>
		<artifactId>extentreports</artifactId>
		<version>4.0.9</version>
</dependency>
	<dependency>
	 	<groupId>log4j</groupId>
		<artifactId>log4j</artifactId>
		<version>1.2.17</version>
	</dependency>
	<dependency>
		<groupId>com.google.code.gson</groupId>
		<artifactId>gson</artifactId>
		<version>2.8.2</version>
	</dependency>
	
	<dependency>
		<groupId>io.appium</groupId>
		<artifactId>java-client</artifactId>
		<version>7.5.0</version>
	</dependency>
	
	<!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
	<dependency>
		<groupId>com.google.guava</groupId>
		<artifactId>guava</artifactId>
		<version>23.0</version>
	</dependency>	
	
	<!-- https://mvnrepository.com/artifact/io.github.bonigarcia/webdrivermanager -->
<dependency>
	<groupId>io.github.bonigarcia</groupId>
	<artifactId>webdrivermanager</artifactId>
 	<version>5.7.0</version> 
</dependency>
	
	<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-simple -->
<dependency>
	<groupId>org.slf4j</groupId>
	<artifactId>slf4j-simple</artifactId>
	<version>1.7.30</version>
</dependency>
	

	
	<!-- https://mvnrepository.com/artifact/junit/junit -->
junit junit 4.13.2
  </dependencies>
  
  
<!--   <profiles>
	<profile>
		<id>regression-Module1</id>
		<build>
			<plugins>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-surefire-plugin</artifactId>
					<version>2.21.0</version>
					<configuration>
						<suiteXmlFiles>
							<suiteXmlFile>BVTcase.xml</suiteXmlFile>
						</suiteXmlFiles>
					</configuration>
				</plugin>
			</plugins>
		</build>
	</profile>
	
</profiles>-->
  
  
  
  	<build>
	<plugins>
		<plugin>
			<artifactId>maven-compiler-plugin</artifactId>
			<version>3.8.1</version>
			<configuration>
				<source>1.8</source>
				<target>1.8</target>
			</configuration>
		</plugin>
		<plugin>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-surefire-plugin</artifactId>
			<version>2.19.1</version>
			<configuration>
				<suiteXmlFiles>
					<suiteXmlFile>BVTcase.xml</suiteXmlFile>
				</suiteXmlFiles>
				
			</configuration>
		</plugin>
	</plugins>
</build>
org.apache.maven.plugins maven-surefire-report-plugin 2.19.1

@sujeetneha
Copy link

I stuck from last 7 days please help me.

Copy link

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

@github-actions github-actions bot locked and limited conversation to collaborators Jun 16, 2024
sandeepsuryaprasad pushed a commit to sandeepsuryaprasad/selenium that referenced this issue Oct 29, 2024
And later returning them as PersistentCapabilities
Also, restoring the null check in PersistentCapabilities.java

Fixes SeleniumHQ#13937
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants