我无法在Android工作室的真实Android设备上连接或运行脚本,并且出现以下错误:
代码如下: import org.junit.Before;
import java.net.URL;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import io.appium.java_client.android.AndroidDriver;
public class Sample {
private static RemoteWebDriver driver;
@Before
public void setUp() throws Exception {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("device","Android");
capabilities.setCapability("app", "Chrome");
capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
capabilities.setCapability(CapabilityType.VERSION, "4.4.2");
capabilities.setCapability(CapabilityType.PLATFORM, "WINDOWS");
driver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"),
capabilities);
}
@Test
public void testcase_001() throws Exception{
driver.get("http://www.google.com");
WebElement keyword = driver.findElementByName("q");
keyword.sendKeys("appium");
driver.findElement(By.id("btnK")).click();
Thread.sleep(5000);
}
}
但该设备列在Android设备监视器
中显示连接在cmd
我尝试过的事情正在改变以下设置:
任何想法出了什么问题
答案 0 :(得分:0)
如果您之前已经安装过,请删除最后一个apk并尝试安装新的apk。