Getting "org.openqa.selenium.UnsupportedCommandException: getSession" while using java-client 6.0.0 when we call AndroidDriver<>(new HttpCommandExecutor(url), capabilities);
@SrinivasanTarget is already working on this.
Since Jul 2, 2018.
- Dominant language
- Java
- Stars
- 1.3k
- Forks
- 752
- Avg merge
- 6d 21h
- Merged PRs (30d)
- 8
Description
Description
Getting "org.openqa.selenium.UnsupportedCommandException: getSession" while using java-client 6.0.0 when we call AndroidDriver<>(new HttpCommandExecutor(url), capabilities);
It's working fine in java-client 6.0.0 Beta4.
But it does not work in java-client 6.0.0 Beta5.
Environment
- java client build version or git revision if you use some shapshot:
- Appium server version or git revision if you use some shapshot:
- Desktop OS/version used to run Appium if necessary:
- Node.js version (unless using Appium.app|exe) or Appium CLI or Appium.app|exe:
- Mobile platform/version under test:
- Real device or emulator/simulator:
Details
Please provide more details, if necessary.
Code To Reproduce Issue [ Good To Have ]
public class AppiumTest {
public static AndroidDriver<?> mobileDriver = null;
public static void main(String[] args) throws MalformedURLException, Exception {
// TODO Auto-generated method stub
try {
URL url = new URL("http://0.0.0.0:4723/wd/hub");
// This is Launcher activity of your app
// (you can get it from apk info app)
// This package name of your app (you can get it from apk info app)
DesiredCapabilities capabilities = new DesiredCapabilities();
// capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, "Android");
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "GalaxyS5");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, AutomationName.ANDROID_UIAUTOMATOR2);
capabilities.setCapability(MobileCapabilityType.APP,
"C:\Users\bharavin\Downloads\com.snapdeal.main_2018-01-26.apk");
capabilities.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, 120);
// capabilities.setCapability(MobileCapabilityType.APPLICATION, "com.snapdeal.main");
capabilities.setCapability(MobileCapabilityType.UDID, "4d007c754dca412f");
AndroidDriver mobileDriver = new AndroidDriver<>(new HttpCommandExecutor(url), capabilities);
//AppiumDriver<AndroidElement> mobileDriver = new AppiumDriver<>(url, capabilities);
//AndroidDriver<AndroidElement> mobileDriver = new AndroidDriver<>(url, capabilities);
mobileDriver.getSessionId();
mobileDriver.installApp("C:\\Users\\bharavin\\Downloads\\com.snapdeal.main_2018-01-26.apk");
System.out.println("App Installed");
Thread.sleep(6000);
mobileDriver.launchApp();
System.out.println("App Launched");
Thread.sleep(6000);
mobileDriver.findElement(By.xpath("//android.widget.TextView[contains(@text,'Fashion')]")).click();
System.out.println("Element located and clicked on App");
Thread.sleep(6000);
mobileDriver.quit();
Thread.sleep(3000);
} catch (Exception e) {
// mobileDriver = null;
e.printStackTrace();
// System.out.println(e.toString());
}
}
}
Ecxeption stacktraces
Jun 21, 2018 8:02:48 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS
org.openqa.selenium.UnsupportedCommandException: getSession
Build info: version: '3.7.1', revision: '8a0099a', time: '2017-11-06T21:01:39.354Z'
System info: ', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_161'
Driver info: driver.version: AndroidDriver
at org.openqa.selenium.remote.http.AbstractHttpCommandCodec.encode(AbstractHttpCommandCodec.java:219)
at org.openqa.selenium.remote.http.AbstractHttpCommandCodec.encode(AbstractHttpCommandCodec.java:118)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:600)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:46)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
at io.appium.java_client.HasSessionDetails.getSessionDetails(HasSessionDetails.java:39)
at io.appium.java_client.HasSessionDetails.getSessionDetail(HasSessionDetails.java:56)
at io.appium.java_client.HasSessionDetails.getPlatformName(HasSessionDetails.java:65)
at io.appium.java_client.internal.JsonToMobileElementConverter.(JsonToMobileElementConverter.java:49)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:89)
at io.appium.java_client.android.AndroidDriver.(AndroidDriver.java:78)
at com.appiumupgrade.check.AppiumTest.main(AppiumTest.java:60)
Link to Appium logs
[Appium] Welcome to Appium v1.8.1
[Appium] Appium REST http interface listener started on 0.0.0.0:4723
Appium server is not hit at all. No logs updated.
java file attached for reference.
@TikhomirovSergey @saikrishna321
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.