appium を使用して Android フォンのブラウザを自動化したいのですが、機能の設定方法がわかりません。
まず、開発者向けオプションで Android デバイスの USB デバッグを有効にしました。
第二に、adb はうまく機能していました。デバイス ID を確認できます。
第三に、Appium for windows から Appium.exe を起動し、JAVA でコードを書きましたが、Android ブラウザーで機能を設定する方法がわかりません。
public class Test {
private WebDriver driver;
@Before
public void setUp() throws Exception {
DesiredCapabilities capabilities = new DesiredCapabilities();
//------------I don't know how to set the capability------------//
capabilities.setCapability(CapabilityType.VERSION, "2.3.7");
capabilities.setCapability(CapabilityType.PLATFORM, "WINDOWS");
//--------------------------------------------------------------//
driver = new SwipeableWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
}
@Test
public void testcase_001() throws Exception{
driver.get("http://www.google.com");
WebDriverWait wait = new WebDriverWait(driver, 30);
wait.until(ExpectedConditions.presenceOfElementLocated(By.id("lst-ib")));
WebElement keyword = driver.findElement(By.name("lst-ib"));
keyword.sendKeys("appium");
driver.findElement(By.id("btnK")).click();
Thread.sleep(5000);
}
@After
public void tearDown() throws Exception {
driver.quit();
}
public class SwipeableWebDriver extends RemoteWebDriver implements HasTouchScreen {
private RemoteTouchScreen touch;
public SwipeableWebDriver(URL remoteAddress, Capabilities desiredCapabilities) {
super(remoteAddress, desiredCapabilities);
touch = new RemoteTouchScreen(getExecuteMethod());
}
public TouchScreen getTouch() {
return touch;
}
}
}
どうもありがとう。