Opening mobile browser does not work

Hi,

i am new to Appium and facing an issue that i were not able to solve.

my first test was automating a android app which worked fine.

now what i want to do is just opening the chrome browser on a real phone and insert a link into the adress bar.

i’ve gone to the appium server and choose “use browser” and “chrome”. Then i clicked on the inspect button, but i only get an error message.

[ADB] Error: Remote install failed: pkg: /data/local/tmp/cbc11a77254763d177b487453d570936.apk
Failure [INSTALL_FAILED_NO_MATCHING_ABIS]
    at Object.wrappedLogger.errorAndThrow (lib/logger.js:60:13)
    at ADB.callee$0$0$ (lib/tools/apk-utils.js:175:9)
    at tryCatch (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
    at GeneratorFunctionPrototype.invoke (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
    at run (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/node_modules/core-js/library/modules/es6.promise.js:104:47)
    at /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/node_modules/core-js/library/modules/es6.promise.js:115:28
    at flush (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/node_modules/core-js/library/modules/$.microtask.js:19:5)
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)
 [Error: Remote install failed: pkg: /data/local/tmp/cbc11a77254763d177b487453d570936.apk
Failure [INSTALL_FAILED_NO_MATCHING_ABIS]]

[AndroidDriver] Installing remote APK failed, going to uninstall and try again

I also tried to do this form intellij and also there i only got a error message.
in intellij i use the following code :

@Before

public void setup() throws MalformedURLException, InterruptedException {

DesiredCapabilities cap=new DesiredCapabilities();
cap.setCapability(MobileCapabilityType.PLATFORM_NAME, MobilePlatform.ANDROID);
cap.setCapability(MobileCapabilityType.DEVICE_NAME,"AndroidTVSmiles");
cap.setCapability(MobileCapabilityType.BROWSER_NAME,"Browser");
cap.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT,"100");

//initialising appium objekt
driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"),cap);
System.out.println("Mobile browser should open");
driver.get("http//google.com");

Thread.sleep(50000);

Then in android server i get the following error :

[MJSONWP] Encountered internal error running command: Error: New app path browser did not have extension .apk
    at Object.configureApp$ (lib/basedriver/helpers.js:41:11)
    at tryCatch (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
    at invoke (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
    at enqueueResult (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:185:17)
    at new Promise (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/node_modules/core-js/library/modules/es6.promise.js:197:7)
    at AsyncIterator.enqueue (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:184:12)
    at AsyncIterator.prototype.(anonymous function) [as next] (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)

has somebody an idea what am i doing wrong ?

To launch Chrome on an Android device you will need to have capabilities that are something like:
platformName = “Android”
browserName = “Chrome”
udid = “Insert UDID Here”
deviceName = “Your Device Name Here”
appPackage = "com.android.chrome"

Also be aware that Chrome 54 is not currently supported by Appium, you can find another post about that on the forum.

whats the best way to open chrome from appium ? maybe can i find some example code somewhere ?

i should check if links still work. for doing this i need to put the link into a browser on a real device (or emulator, but thats not optimal)

the links are add links that get forwareded several times since they reach a goal which could be a mobile site or even the app store.

If you use the capabilities above when starting your appium session, chrome should launch (Given your device has Chrome 53 or below). You then should use something like driver.Navigate().GoToUrl(url); (You’ll have to look up the specific Java syntax) to navigate to your initial web page. Your tests can then interact with links on the page and perform validations against the DOM.