0
votes

Unable to launch chrome browser on real device, error found:

-ERROR running Appium command: Arguments to path.resolve must be strings

please help

Launching Appium server with command: C:\Program Files\Appium\node.exe lib\server\main.js --address 127.0.0.1 --port 4723 --chromedriver-port 8080 --platform-name Android --platform-version 19 --automation-name Appium --log-no-color info: Welcome to Appium v1.4.16 (REV ae6877eff263066b26328d457bd285c0cc62430d) info: Appium REST http interface listener started on 127.0.0.1:4723 info: [debug] Non-default server args: {"address":"127.0.0.1","logNoColors":true,"platformName":"Android","platformVersion":"19","automationName":"Appium","chromeDriverPort":8080} info: Console LogLevel: debug info: --> POST /wd/hub/session {"desiredCapabilities":{"appPackage":"com.android.chrome","browserName":"Chrome","platformName":"Android","deviceName":"Android","platformVersion":"4.4.2"}} info: Client User-Agent string: Apache-HttpClient/4.5.1 (Java/1.8.0_91) info: Set mode: Proxying straight through to Chromedriver info: [debug] Looks like we want chrome on android info: <-- POST /wd/hub/session 500 11.995 ms - 95 TypeError: Arguments to path.resolve must be strings at Object.win32.resolve (path.js:146:13) at [object Object].Device.configure (C:\Program Files\Appium\node_modules\appium\lib\devices\device.js:41:31) at [object Object].ChromeAndroid.configure (C:\Program Files\Appium\node_modules\appium\lib\devices\android\chrome.js:51:8) at [object Object].Appium.configure (C:\Program Files\Appium\node_modules\appium\lib\appium.js:250:15) at [object Object]. (C:\Program Files\Appium\node_modules\appium\lib\appium.js:118:10) at [object Object].Appium.start (C:\Program Files\Appium\node_modules\appium\lib\appium.js:129:5) at exports.createSession (C:\Program Files\Appium\node_modules\appium\lib\server\controller.js:188:16) at Layer.handle [as handle_request] (C:\Program Files\Appium\node_modules\appium\node_modules\express\lib\router\layer.js:82:5) at next (C:\Program Files\Appium\node_modules\appium\node_modules\express\lib\router\route.js:110:13) at Route.dispatch (C:\Program Files\Appium\node_modules\appium\node_modules\express\lib\router\route.js:91:3) at Layer.handle [as handle_request] (C:\Program Files\Appium\node_modules\appium\node_modules\express\lib\router\layer.js:82:5) at C:\Program Files\Appium\node_modules\appium\node_modules\express\lib\router\index.js:267:22 at Function.proto.process_params (C:\Program Files\Appium\node_modules\appium\node_modules\express\lib\router\index.js:321:12) at next (C:\Program Files\Appium\node_modules\appium\node_modules\express\lib\router\index.js:261:10) at next (C:\Program Files\Appium\node_modules\appium\node_modules\express\lib\router\route.js:100:14) at next (C:\Program Files\Appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14) at next (C:\Program Files\Appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14) at next (C:\Program Files\Appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14) at next (C:\Program Files\Appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14) at next (C:\Program Files\Appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14) at next (C:\Program Files\Appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14) at next (C:\Program Files\Appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14) at next (C:\Program Files\Appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14) at next (C:\Program Files\Appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14) at next (C:\Program Files\Appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14) at C:\Program Files\Appium\node_modules\appium\lib\server\controller.js:39:7 at Layer.handle [as handle_request] (C:\Program Files\Appium\node_modules\appium\node_modules\express\lib\router\layer.js:82:5) at next (C:\Program Files\Appium\node_modules\appium\node_modules\express\lib\router\route.js:110:13) at next (C:\Program Files\Appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14) at next (C:\Program Files\Appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14) at next (C:\Program Files\Appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14) at next (C:\Program Files\Appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14) at next (C:\Program Files\Appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14) at next (C:\Program Files\Appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14) at next (C:\Program Files\Appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14) at next (C:\Program Files\Appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14) at next (C:\Program Files\Appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14) at next (C:\Program Files\Appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14) at next (C:\Program Files\Appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14) at next (C:\Program Files\Appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14) at next (C:\Program Files\Appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14) at next (C:\Program Files\Appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14) at next (C:\Program Files\Appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14) at Route.dispatch (C:\Program Files\Appium\node_modules\appium\node_modules\express\lib\router\route.js:91:3) at Layer.handle [as handle_request] (C:\Program Files\Appium\node_modules\appium\node_modules\express\lib\router\layer.js:82:5) at C:\Program Files\Appium\node_modules\appium\node_modules\express\lib\router\index.js:267:22 at Function.proto.process_params (C:\Program Files\Appium\node_modules\appium\node_modules\express\lib\router\index.js:321:12) at next (C:\Program Files\Appium\node_modules\appium\node_modules\express\lib\router\index.js:261:10) at methodOverride (C:\Program Files\Appium\node_modules\appium\node_modules\method-override\index.js:79:5) at Layer.handle [as handle_request] (C:\Program Files\Appium\node_modules\appium\node_modules\express\lib\router\layer.js:82:5) at trim_prefix (C:\Program Files\Appium\node_modules\appium\node_modules\express\lib\router\index.js:302:13) at C:\Program Files\Appium\node_modules\appium\node_modules\express\lib\router\index.js:270:7 at Function.proto.process_params (C:\Program Files\Appium\node_modules\appium\node_modules\express\lib\router\index.js:321:12) at next (C:\Program Files\Appium\node_modules\appium\node_modules\express\lib\router\index.js:261:10) at logger (C:\Program Files\Appium\node_modules\appium\node_modules\morgan\index.js:136:5) at Layer.handle [as handle_request] (C:\Program Files\Appium\node_modules\appium\node_modules\express\lib\router\layer.js:82:5) at trim_prefix (C:\Program Files\Appium\node_modules\appium\node_modules\express\lib\router\index.js:302:13) at C:\Program Files\Appium\node_modules\appium\node_modules\express\lib\router\index.js:270:7 at Function.proto.process_params (C:\Program Files\Appium\node_modules\appium\node_modules\express\lib\router\index.js:321:12) at next (C:\Program Files\Appium\node_modules\appium\node_modules\express\lib\router\index.js:261:10) at C:\Program Files\Appium\node_modules\appium\node_modules\body-parser\lib\read.js:111:5 at done (C:\Program Files\Appium\node_modules\appium\node_modules\body-parser\node_modules\raw-body\index.js:248:14) at IncomingMessage.onEnd (C:\Program Files\Appium\node_modules\appium\node_modules\body-parser\node_modules\raw-body\index.js:294:7) at IncomingMessage.g (events.js:199:16)

2
can you share the code as wellSaurabh Verma
pls check snapshot attached code is thereNarendra Singh
@NarendraSingh, i'm sorry i never worked on Appium, but just wanted to know a bit about the issue and see if can help, which line of code is throwing this error?. From the error i understand that one of the lines of the code, instead of passing string you have passed some thing else.Siva
@siva line 22 is showing the errorNarendra Singh

2 Answers

1
votes

Refer the following code to solve your problem

AppiumDriver driver;
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("deviceName", "Android");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability(CapabilityType.BROWSER_NAME, "Chrome");
capabilities.setCapability("platformVersion", "5.0.2");
capabilities.setCapability("appPackage", "com.android.chrome");
capabilities.setCapability("appActivity","com.google.android.apps.chrome.ChromeTabbedActivity");
driver= new AppiumDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
driver.get("http://google.com");
0
votes

@Narendra Singh - The below solution should work -

private AndroidDriver driver;
public static String baseurl;

@Before
public void setup() throws MalformedURLException
{
    System.out.println("Create driver and launch Chrome");
    DesiredCapabilities capabilities = new DesiredCapabilities ();
    capabilities.setCapability("browsername","chrome");
    capabilities.setCapability("device","android");
    capabilities.setCapability("devicename","OssCube");
    capabilities.setCapability("platformversion","4.4.2");
    capabilities.setCapability("platformname","Android");
    capabilities.setCapability("appPackage","com.android.chrome");
   capabilities.setCapability("appActivity","com.google.android.apps.chrome.Main");
    driver=new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
    baseurl = "https://www.google.com";
    driver.get(baseurl);
    }

How do you run your test?