Запускаю в командной строке: appium
Потом запускаю код
import java.net.MalformedURLException;
import java.net.URL;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.AndroidKeyCode;
import org.openqa.selenium.remote.DesiredCapabilities;
public class FirstTest {
public static void main(String[] args) throws MalformedURLException {
DesiredCapabilities c = new DesiredCapabilities();
c.setCapability("deviceName", "24ece61a");
c.setCapability("platformName", "Android");
c.setCapability("app", "C:\\Appium\\InstalledAppium\\Appium\\node_modules\\appium\\build\\unlock_apk\\unlock_apk-debug.apk");
AndroidDriver driver = new AndroidDriver(new URL("http://0.0.0.0:4723/wd/hub"), c);
driver.pressKeyCode(AndroidKeyCode.HOME);
driver.findElementByAndroidUIAutomator("New UiSelector().description(\"Приложения\")").click();
driver.quit();
}
}
С такими зависимостями
compile group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '2.53.1'
compile group: 'io.appium', name: 'java-client', version: '4.1.2'
compile group: 'junit', name: 'junit', version: '4.12'
выдает ошибку ,эта ошибка возникает что не может найти элемент по селектору? и надо по другому селектор написать? Или возникает когда неправильно настроены установленные программы?
Exception in thread "main" org.openqa.selenium.UnsupportedCommandException: The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource. (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 47 milliseconds
Build info: version: '2.53.1', revision: 'a36b8b1cd5757287168e54b817830adce9b0158d', time: '2016-06-30 19:26:09'
System info: host: 'Administrator', ip: '192.168.0.75', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_121'
Driver info: io.appium.java_client.android.AndroidDriver
Capabilities [{app=C:\Appium\InstalledAppium\Appium\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk, appPackage=io.appium.unlock, deviceScreenSize=720x1280, networkConnectionEnabled=true, warnings={}, appWaitPackage=io.appium.unlock, appWaitActivity=io.appium.unlock.Unlock, databaseEnabled=false, deviceName=24ece61a, platform=LINUX, deviceUDID=24ece61a, appActivity=io.appium.unlock.Unlock, desired={app=C:\Appium\InstalledAppium\Appium\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk, platformName=Android, deviceName=24ece61a}, platformVersion=4.3, webStorageEnabled=false, locationContextEnabled=false, takesScreenshot=true, javascriptEnabled=true, deviceModel=Boost IIse, platformName=Android, deviceManufacturer=HighScreen}]
Session ID: e7499f64-fe32-4a98-a2b4-4ad55daa7a17
*** Element info: {Using=-android uiautomator, value=New UiSelector().description("Приложения")}
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:40)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:363)
at io.appium.java_client.DefaultGenericMobileDriver.findElement(DefaultGenericMobileDriver.java:56)
at io.appium.java_client.AppiumDriver.findElement(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.findElement(AndroidDriver.java:1)
at io.appium.java_client.android.AndroidDriver.findElementByAndroidUIAutomator(AndroidDriver.java:365)
at FirstTest.main(FirstTest.java:24)