启动appium浏览器时出错: - org.openqa.selenium.WebDriverException:ERROR运行Appium命令:path.resolve的参数必须是字符串

时间:2016-08-23 05:12:05

标签: java selenium appium appium-ios python-appium

无法在真实设备上启动Chrome浏览器,发现错误:

  

-ERROR运行Appium命令:path.resolve的参数必须是字符串

please help

  

使用以下命令启动Appium服务器: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:欢迎来到Appium v​​1.4.16(REV ae6877eff263066b26328d457bd285c0cc62430d)   info:Appium REST http接口监听器在127.0.0.1:4723上启动   info:[debug]非默认服务器args:{"地址":" 127.0.0.1"," logNoColors":true," platformName&# 34;:" Android和#34;" platformVersion":" 19"" automationName":" Appium"&# 34; chromeDriverPort":8080}   info:Console LogLevel:debug   信息: - > POST / wd / hub / session {" desiredCapabilities":{" appPackage":" com.android.chrome"," browserName":& #34;铬"" platformName":" Android和#34;" DEVICENAME":" Android和#34;" platformVersion&# 34;:" 4.4.2"}}   info:客户端用户代理字符串:Apache-HttpClient / 4.5.1(Java / 1.8.0_91)   info:设置模式:直接进入Chromedriver   info:[debug]看起来我们想要android上的chrome   info:< - POST / wd / hub / session 500 11.995 ms - 95   TypeError:path.resolve的参数必须是字符串       在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)       在[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)       在exports.createSession(C:\ Program Files \ Appium \ node_modules \ appium \ lib \ server \ controller.js:188:16)       在Layer.handle [as handle_request](C:\ Program Files \ Appium \ node_modules \ appium \ node_modules \ express \ lib \ router \ layer.js:82:5)       在下一个(C:\ Program Files \ Appium \ node_modules \ appium \ node_modules \ express \ lib \ router \ route.js:110:13)       在Route.dispatch(C:\ Program Files \ Appium \ node_modules \ appium \ node_modules \ express \ lib \ router \ route.js:91:3)       在Layer.handle [as handle_request](C:\ Program Files \ Appium \ node_modules \ appium \ node_modules \ express \ lib \ router \ layer.js:82:5)       在C:\ Program Files \ Appium \ node_modules \ appium \ node_modules \ express \ lib \ router \ index.js:267:22       在Function.proto.process_params(C:\ Program Files \ Appium \ node_modules \ appium \ node_modules \ express \ lib \ router \ index.js:321:12)       在下一个(C:\ Program Files \ Appium \ node_modules \ appium \ node_modules \ express \ lib \ router \ index.js:261:10)       在下一个(C:\ Program Files \ Appium \ node_modules \ appium \ node_modules \ express \ lib \ router \ route.js:100:14)       在下一个(C:\ Program Files \ Appium \ node_modules \ appium \ node_modules \ express \ lib \ router \ route.js:104:14)       在下一个(C:\ Program Files \ Appium \ node_modules \ appium \ node_modules \ express \ lib \ router \ route.js:104:14)       在下一个(C:\ Program Files \ Appium \ node_modules \ appium \ node_modules \ express \ lib \ router \ route.js:104:14)       在下一个(C:\ Program Files \ Appium \ node_modules \ appium \ node_modules \ express \ lib \ router \ route.js:104:14)       在下一个(C:\ Program Files \ Appium \ node_modules \ appium \ node_modules \ express \ lib \ router \ route.js:104:14)       在下一个(C:\ Program Files \ Appium \ node_modules \ appium \ node_modules \ express \ lib \ router \ route.js:104:14)       在下一个(C:\ Program Files \ Appium \ node_modules \ appium \ node_modules \ express \ lib \ router \ route.js:104:14)       在下一个(C:\ Program Files \ Appium \ node_modules \ appium \ node_modules \ express \ lib \ router \ route.js:104:14)       在下一个(C:\ Program Files \ Appium \ node_modules \ appium \ node_modules \ express \ lib \ router \ route.js:104:14)       在下一个(C:\ Program Files \ Appium \ node_modules \ appium \ node_modules \ express \ lib \ router \ route.js:104:14)       在C:\ Program Files \ Appium \ node_modules \ appium \ lib \ server \ controller.js:39:7       在Layer.handle [as handle_request](C:\ Program Files \ Appium \ node_modules \ appium \ node_modules \ express \ lib \ router \ layer.js:82:5)       在下一个(C:\ Program Files \ Appium \ node_modules \ appium \ node_modules \ express \ lib \ router \ route.js:110:13)       在下一个(C:\ Program Files \ Appium \ node_modules \ appium \ node_modules \ express \ lib \ router \ route.js:104:14)       在下一个(C:\ Program Files \ Appium \ node_modules \ appium \ node_modules \ express \ lib \ router \ route.js:104:14)       在下一个(C:\ Program Files \ Appium \ node_modules \ appium \ node_modules \ express \ lib \ router \ route.js:104:14)       在下一个(C:\ Program Files \ Appium \ node_modules \ appium \ node_modules \ express \ lib \ router \ route.js:104:14)       在下一个(C:\ Program Files \ Appium \ node_modules \ appium \ node_modules \ express \ lib \ router \ route.js:104:14)       在下一个(C:\ Program Files \ Appium \ node_modules \ appium \ node_modules \ express \ lib \ router \ route.js:104:14)       在下一个(C:\ Program Files \ Appium \ node_modules \ appium \ node_modules \ express \ lib \ router \ route.js:104:14)       在下一个(C:\ Program Files \ Appium \ node_modules \ appium \ node_modules \ express \ lib \ router \ route.js:104:14)       在下一个(C:\ Program Files \ Appium \ node_modules \ appium \ node_modules \ express \ lib \ router \ route.js:104:14)       在下一个(C:\ Program Files \ Appium \ node_modules \ appium \ node_modules \ express \ lib \ router \ route.js:104:14)       在下一个(C:\ Program Files \ Appium \ node_modules \ appium \ node_modules \ express \ lib \ router \ route.js:104:14)       在下一个(C:\ Program Files \ Appium \ node_modules \ appium \ node_modules \ express \ lib \ router \ route.js:104:14)       在下一个(C:\ Program Files \ Appium \ node_modules \ appium \ node_modules \ express \ lib \ router \ route.js:104:14)       在下一个(C:\ Program Files \ Appium \ node_modules \ appium \ node_modules \ express \ lib \ router \ route.js:104:14)       在下一个(C:\ Program Files \ Appium \ node_modules \ appium \ node_modules \ express \ lib \ router \ route.js:104:14)       在Route.dispatch(C:\ Program Files \ Appium \ node_modules \ appium \ node_modules \ express \ lib \ router \ route.js:91:3)       在Layer.handle [as handle_request](C:\ Program Files \ Appium \ node_modules \ appium \ node_modules \ express \ lib \ router \ layer.js:82:5)       在C:\ Program Files \ Appium \ node_modules \ appium \ node_modules \ express \ lib \ router \ index.js:267:22       在Function.proto.process_params(C:\ Program Files \ Appium \ node_modules \ appium \ node_modules \ express \ lib \ router \ index.js:321:12)       在下一个(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)       在Layer.handle [as handle_request](C:\ Program Files \ Appium \ node_modules \ appium \ node_modules \ express \ lib \ router \ layer.js:82:5)       在trim_prefix(C:\ Program Files \ Appium \ node_modules \ appium \ node_modules \ express \ lib \ router \ index.js:302:13)       在C:\ Program Files \ Appium \ node_modules \ appium \ node_modules \ express \ lib \ router \ index.js:270:7       在Function.proto.process_params(C:\ Program Files \ Appium \ node_modules \ appium \ node_modules \ express \ lib \ router \ index.js:321:12)       在下一个(C:\ Program Files \ Appium \ node_modules \ appium \ node_modules \ express \ lib \ router \ index.js:261:10)       在记录器(C:\ Program Files \ Appium \ node_modules \ appium \ node_modules \ morgan \ index.js:136:5)       在Layer.handle [as handle_request](C:\ Program Files \ Appium \ node_modules \ appium \ node_modules \ express \ lib \ router \ layer.js:82:5)       在trim_prefix(C:\ Program Files \ Appium \ node_modules \ appium \ node_modules \ express \ lib \ router \ index.js:302:13)       在C:\ Program Files \ Appium \ node_modules \ appium \ node_modules \ express \ lib \ router \ index.js:270:7       在Function.proto.process_params(C:\ Program Files \ Appium \ node_modules \ appium \ node_modules \ express \ lib \ router \ index.js:321:12)       在下一个(C:\ Program Files \ Appium \ node_modules \ appium \ node_modules \ express \ lib \ router \ index.js:261:10)       在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)       在IncomingMessage.onEnd(C:\ Program Files \ Appium \ node_modules \ appium \ node_modules \ body-parser \ node_modules \ raw-body \ index.js:294:7)       在IncomingMessage.g(events.js:199:16)

2 个答案:

答案 0 :(得分:1)

请参阅以下代码以解决您的问题

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");

答案 1 :(得分:0)

@Narendra Singh - 以下解决方案应该有效 -

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);
    }

你如何进行测试?