This site is in read only mode. Please continue to browse, but replying, likes, and other actions are disabled for now.
21 / 31
Aug 2017

This broke for me all of a sudden with no changes to my dependencies or code (I was actually on vacation over the weekend) for weeks. I believe this started failing Friday 8/18 (We saw some other weird issues in another repo around dependencies, and had to force selenium 3.4.0 to ignore guava and force guava 21.0 as it was trying to use 23.0).

Indeed it appears as though the selenium 3.5.1 release has fouled up some older dependencies that may not have been specific enough, as my 3.3.0 selenium is “upgrading” to 3.5.1:

+--- org.seleniumhq.selenium:selenium-java:3.3.0
|    +--- org.seleniumhq.selenium:selenium-chrome-driver:3.3.0
|    |    \--- org.seleniumhq.selenium:selenium-remote-driver:3.3.0 -> 3.5.1
|    |         +--- org.seleniumhq.selenium:selenium-api:3.5.1
|    |         +--- cglib:cglib-nodep:3.2.4
|    |         +--- org.apache.commons:commons-exec:1.3
|    |         +--- commons-codec:commons-codec:1.10
|    |         +--- commons-logging:commons-logging:1.2
|    |         +--- com.google.code.gson:gson:2.8.0 -> 2.8.1
|    |         +--- com.google.guava:guava:23.0

Looks like the issue is in the selenium htmlunit dependency that’s grabbing 3.5.1 causing everythingelse to be upgraded

|    \--- org.seleniumhq.selenium:htmlunit-driver:2.24
|         +--- org.seleniumhq.selenium:selenium-support:[2.53.0,4.0.0) -> 3.5.1
|         |    +--- org.seleniumhq.selenium:selenium-api:3.5.1
|         |    +--- org.seleniumhq.selenium:selenium-remote-driver:3.5.1 (*)

To fix this, force seleniumjava to a version, then ignore guava from it (gradle example):

// Selenium 3.5.1 released, caused older selenium issues, so need to force guava to 21.0 and other
// sub-modules where we want them.  thanks htmlunit-driver!

// Uncomment this line, and remove bottom section if things get fixed or you upgrade
// all the way to selenium 3.5.1... but appium doesn't play well with it yet
// compile("org.seleniumhq.selenium:selenium-java:3.3.0")

// All this can go away if htmlunit-driver is fixed for older selenium versions
compile("io.appium:java-client:5.0.0-BETA9") {
    exclude group: 'org.seleniumhq.selenium', module: 'selenium-java'
}
compile("org.seleniumhq.selenium:selenium-java:3.3.0") {
    exclude group: 'org.seleniumhq.selenium', module: 'htmlunit-driver'
}
// If you need parts of htmlunit-driver dependencies, uncomment this
// compile("org.seleniumhq.selenium:htmlunit-driver:2.26") {
//     exclude group: 'org.seleniumhq.selenium', module: 'selenium-api'
//     exclude group: 'org.seleniumhq.selenium', module: 'selenium-support'
// }
compile group: 'org.seleniumhq.selenium', name: 'selenium-support', version: "3.3.0"
// Make sure guava is 21.0... others don't play well
compile group: 'com.google.guava', name: 'guava', version: '21.0'
// If you need codec stuff from newer commons-codec
compile group: 'commons-codec', name: 'commons-codec', version: '1.10'
1 month later

Yes selenium 3.5.1 is the culprit, downgrading to 3.4 had successfully able to locate native elements in Android

1 month later

I faced similar issue with iOS 11.0 and got resolved when i updated java-client to latest i.e., 5.0.4

26 days later
  1. Add commons-lang3-3.1.jar in library
  2. Use java-client-5.0.4.jar instead of previous version.

Your Problem will be solved.

1 month later

Hi All,

I am still getting same error eventhough I am using latest versions…

	<artifactId>java-client</artifactId>
	<version>4.1.2</version>

          <artifactId>selenium-java</artifactId>
            <version>3.8.1</version

Src:==>

public class StartApplication {

	private static AndroidDriver driver;

	
	public static void main() throws MalformedURLException, InterruptedException {

		DesiredCapabilities capabilities = new DesiredCapabilities();
		capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
		capabilities.setCapability("deviceName", "MotoG");
		capabilities.setCapability("platformVersion", "6.0");
		capabilities.setCapability("platformName", "Android");
		 capabilities.setCapability("appPackage", "abc.xys.test");
		capabilities.setCapability("appActivity", "abc.xys.test.HomeActivity");
		driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
		driver.manage().timeouts().implicitlyWait(80, TimeUnit.SECONDS); 
		Thread.sleep(10000);
		driver.findElementById("android:id/up").click();		
								

}

Console O/P ==>
java.lang.NullPointerException at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:279) at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:83)

Please Help…