Question

Here's my code:

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("device","Android");
capabilities.setCapability("app", "Browser");
capabilities.setCapability(CapabilityType.BROWSER_NAME, "Android");
capabilities.setCapability(CapabilityType.VERSION, "4.4");
capabilities.setCapability(CapabilityType.PLATFORM, "Ubuntu");
driver = new RemoteWebDriver(new URL("//127.0.0.1:4723/wd/hub"), capabilities);
driver .get(URL);

It throws an exception in appium server. ![appium][1]

and it says:

org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: Could not find a connected Android device.) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 20.43 seconds
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'xyz', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'i386', os.version: '3.8.0-29-generic', java.version: '1.7.0_51'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
Was it helpful?

Solution

yes, we can run the appium without source code for this you have to give the apk file path and need to delete the activity and package name from the capabilities.

OTHER TIPS

Dont pass “app” capability then appium will launch the installed app based on package name and launch activity name passed from desired capabilities

No, you have to have specify an apk file and/or activity & package configurations.

for hybrid apps, you only need both the apk file and activity & package configurations.

for webapps, you only need the apk file and make sure to specify which browser to use and also configure user agent.

for native apps, you must delete or comment out the apk file and must have configured the activity & package configurations.

That error happens for 3 reasons I can think of off the top of my head.

  1. You did not turn on appium server.
  2. Your previous test did not completely terminate.
  3. You did not give any indications as to which app needs testing.
  4. If you do not meet the criteria to launch web,hybrid and native apps.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top