Поскольку я новичок в мобильной автоматизации, я пытался выполнять простые действия, используя appium maven и eclipse.Но когда я пытаюсь запустить приложение Калькулятор открывается, но элементы не доступны.
Этот код я использовал для запуска простого калькулятора
@BeforeClass
public void setUp() throws MalformedURLException {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("BROWSER_NAME", "Android");
capabilities.setCapability("VERSION", "4.4.2");
capabilities.setCapability("deviceName", "Emulator");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("appPackage", "com.android.calculator2");
capabilities.setCapability("appActivity", "com.android.calculator2.Calculator");
driver = new RemoteWebDriver(new URL("http://0.0.0.0:4723/wd/hub"), capabilities);
}
@Test
public void testCal() throws Exception {
WebElement two = driver.findElement(By.name("2"));
two.click();
}
@AfterClass
public void teardown() {
}
Я использую последнюю стабильнуюзависимости. io.appium java-client 7.0.0 и org.testng testng 6.14.3
FAILED: testCal
org.openqa.selenium.InvalidSelectorException: Locator Strategy 'css
selector' is not supported for this session
For documentation on this error, please visit:
https://www.seleniumhq.org/exceptions/invalid_selector_exception.html
Driver info: org.openqa.selenium.remote.RemoteWebDriver
Capabilities {BROWSER_NAME: Android, VERSION: 4.4.2, appActivity:
com.android.calculator2.Cal..., appPackage: com.android.calculator2,
databaseEnabled: false, desired: {BROWSER_NAME: Android, VERSION: 4.4.2,
appActivity: com.android.calculator2.Cal..., appPackage:
com.android.calculator2, deviceName: Emulator, platformName: android},
deviceManufacturer: HUAWEI, deviceModel: FLA-LX2, deviceName:
HXT7N18521000819, deviceScreenSize: 1080x2160, deviceUDID:
HXT7N18521000819, javascriptEnabled: true, locationContextEnabled: false,
networkConnectionEnabled: true, platform: LINUX, platformName: LINUX,
platformVersion: 8.0.0, takesScreenshot: true, warnings: {},
webStorageEnabled: false}
Session ID: a604a166-3c0d-4e9c-a3e4-9b1ea734bee6
*** Element info: {Using=name, value=2}
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown
Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at...