Selendroid:无法在智能手机上启动应用

时间:2019-10-29 13:28:45

标签: java selenium selendroid

我启动了Selendroid服务器:

java -jar selendroid-standalone-0.17.0-with-dependencies -app Guru99App.apk

测试App Guru99App.apk已签名。

然后我在Eclipse中运行了这段代码:

import io.selendroid.standalone.SelendroidConfiguration;
import io.selendroid.standalone.SelendroidLauncher;
import io.selendroid.common.SelendroidCapabilities;
import io.selendroid.client.SelendroidDriver;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.Test;

public class SelendroidTest1 {
    private static SelendroidLauncher selendroidServer = null;
    private static WebDriver driver = null;

    @Test
    public void selendroidTest() throws Exception {                                               
        System.out.print("Start executing test");   
        SelendroidConfiguration config = new SelendroidConfiguration();
        selendroidServer = new SelendroidLauncher(config);
        selendroidServer.launchSelendroid();
        DesiredCapabilities caps = SelendroidCapabilities.android();
        driver = new SelendroidDriver(caps);                                 
    }


    @AfterSuite
    public void tearDown() {
        driver.quit();
    }
}           

我的智能手机已连接,我也检查了“ adb设备”,但仍然收到此异常: '没有找到设备。如果设备正在使用中,或者没有设备屏幕与所需功能相匹配,则会发生这种情况。'

我还尝试通过以下方式启动服务器:

java -jar selendroid-standalone-0.17.0-with-dependencies -aut Guru99App.apk

我认为问题是由于不支持的Android版本引起的,所以我尝试了此操作:

SelendroidCapabilities caps = new SelendroidCapabilities("com.guru99app:1.0");  
caps.setPlatformVersion(io.selendroid.common.device.DeviceTargetPlatform.ANDROID10);    
caps.setEmulator(false);                   
driver = new SelendroidDriver(caps);    

这也没有帮助。 我正在使用Motorola Moto手机。 我该怎么解决?

0 个答案:

没有答案