0

无法在真机上启动chrome浏览器,发现错误:

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

请帮忙

15) 在 [object 对象]。(C:\Program Files\Appium\node_modules\appium\lib\appium.js:118:10) 在 [object Object].Appium.start (C:\Program Files\Appium\node_modules\appium\lib\appium.js :129:5) 在出口.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:

4

2 回答 2

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");
于 2016-08-23T07:39:25.410 回答
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);
    }

你如何运行你的测试?

于 2016-08-23T14:36:08.050 回答