java - How to add app file to appium Desired Capabilities correctly? -
i used saucelabs example
desiredcapabilities capabilities = new desiredcapabilities(); capabilities.setcapability("browser_name", "android"); capabilities.setcapability("version", "4.4.2"); capabilities.setcapability("devicename", "android emulator"); capabilities.setcapability("platformname", "android"); //zip file containing app tested capabilities.setcapability("app", "http://appium.s3.amazonaws.com/testapp6.0.app.zip"); driver = new remotewebdriver (new url(messageformat.format("http://{0}:{1}@ondemand.saucelabs.com:80/wd/hub", sauceusername, sauceaccesskey)), capabilities);
and work fine. when downloaded zip app , switched local environment
capabilities.setcapability("app", app.getabsolutepath()); driver = new remotewebdriver(new url("http://0.0.0.0:4723/wd/hub"), capabilities);
i got error appium console:
error: failed start appium session, err was: error: bad app: /home/.../appium/assets/testapp6.0.app.zip. app paths need absolute, or relative appium server install dir, or url compressed file, or special app name. cause: app zip unzipped ok, couldn't find .app bundle in it. make sure archive contains .app package , nothing else
try instead of remotewebdriver
: use androiddriver
. also, if run localhost
mention ip address or type "localhost"
.
capabilities.setcapability("app", app.getabsolutepath()); driver = new androiddriver (new url("http://localhost:4723/wd/hub"), capabilities);
create folder called "app"
, place testing android app there.
example code:
file filepath = new file(system.getproperty("user.dir")); file appdir = new file(filepath, "/app"); file app = new file(appdir, "yourapkfile.apk");
Comments
Post a Comment