Why is org openqa selenium html5 LocationContext missing when running Appium Java Client 9.5.0 tests?

I was running Appium Java Client v9.5.0 tests and suddenly encounter:

error: cannot find symbol
import org.openqa.selenium.html5.LocationContext;
                           ^
  symbol:   class LocationContext
  location: package org.openqa.selenium.html5

The same setup worked fine earlier, but now the compiler can’t find the LocationContext class. My Maven pom.xml includes Appium 9.5.0 and Selenium dependencies transitively through it, yet this class is missing.

You’re seeing this because LocationContext was removed in Selenium 4. Appium Java Client 9.5.0 depends on Selenium 4+, so the class is no longer available. That’s why your import suddenly fails even though it worked previously with older versions. You’ll need to switch to the new geolocation APIs provided by Appium instead.

I ran into the same problem after upgrading to Appium 9.5.0. LocationContext was part of Selenium 3, and Selenium 4 dropped it. The easiest fix is to stop using LocationContext and use Appium’s current geolocation API:

driver.setLocation(new Location(latitude, longitude, altitude));

This works for both Android and iOS and avoids relying on deprecated classes.

if you really need LocationContext for legacy code, the only way would be to downgrade to Appium + Selenium 3, but that’s not recommended long-term. I switched all my location-based tests to driver.setLocation() and it works reliably in Appium 9.5.0 with Selenium 4.