Created
April 2, 2018 06:42
-
-
Save Phoenix124/99ee7e7bd3b5c29beb711698e9c35aa1 to your computer and use it in GitHub Desktop.
Appium test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class UiAutomatorCheck { | |
public static void main(String[] args) throws MalformedURLException { | |
DesiredCapabilities caps = new DesiredCapabilities(); | |
caps.setCapability("deviceName", "192.168.191.101:5555"); | |
caps.setCapability("platformName", "Android"); | |
caps.setCapability("app", "C:\\cygwin64\\unlock_apk-debug.apk"); | |
AndroidDriver driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), caps); | |
driver.pressKeyCode(AndroidKeyCode.BACK); | |
AndroidElement element = new AndroidElement(); | |
try { | |
Thread.sleep(1000); | |
} catch (InterruptedException e) { | |
e.printStackTrace(); | |
} | |
driver.findElementByAndroidUIAutomator("new UiSelector().text(\"SBOL (dev)\")").click(); | |
// driver.findElement(By.xpath("/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.support.v4.widget.DrawerLayout/android.view.View/android.widget.RelativeLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.LinearLayout[1]/android.widget.FrameLayout/android.widget.EditText")) | |
// .sendKeys("u101"); | |
// driver.findElement(By.xpath("/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.support.v4.widget.DrawerLayout/android.view.View/android.widget.RelativeLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.LinearLayout[2]/android.widget.FrameLayout/android.widget.EditText")) | |
// .sendKeys("password"); | |
// try { | |
// Thread.sleep(1000); | |
// } catch (InterruptedException e) { | |
// e.printStackTrace(); | |
// } | |
// | |
// driver.findElementByAndroidUIAutomator("new UiSelector().text(\"ВОЙТИ\")").click(); | |
// | |
// try { | |
// Thread.sleep(1000); | |
// } catch (InterruptedException e) { | |
// e.printStackTrace(); | |
// } | |
// | |
// driver.findElement(By.xpath("/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.View/android.widget.RelativeLayout/android.widget.RelativeLayout/android.widget.RadioGroup/android.widget.RadioButton[2]")) | |
// .click(); | |
// driver.findElementByAndroidUIAutomator("new UiSelector().text(\"ДАЛЕЕ\")").click(); | |
// | |
// try { | |
// Thread.sleep(300); | |
// } catch (InterruptedException e) { | |
// e.printStackTrace(); | |
// } | |
WebElement btn = driver.findElement(By.xpath("/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.support.v4.widget.DrawerLayout/android.view.View/android.widget.RelativeLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.RelativeLayout/android.widget.LinearLayout[2]/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.LinearLayout[4]/android.widget.ImageView[1]")); | |
IntStream.range(0, 5).parallel().forEach( | |
nbr -> btn.click() | |
); | |
// driver.findElement(By.xpath("/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.LinearLayout[3]/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.LinearLayout[4]/android.widget.ImageView[3]")) | |
// .click(); | |
try { | |
Thread.sleep(5000); | |
} catch (InterruptedException e) { | |
e.printStackTrace(); | |
} | |
// driver.findElement(By.xpath("/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.View/android.widget.RelativeLayout/android.widget.RelativeLayout/android.widget.TextView")) | |
// .click(); | |
driver.findElement(By.xpath("/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.support.v4.widget.DrawerLayout/android.view.View/android.widget.RelativeLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.support.v4.view.ViewPager/android.view.View/android.widget.RelativeLayout/android.widget.RelativeLayout/android.widget.TextView")) | |
.click(); | |
driver.findElement(By.xpath("/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.RelativeLayout/android.widget.TextView")) | |
.click(); | |
driver.findElementByAndroidUIAutomator("new UiScrollable(new UiSelector()).scrollIntoView(" | |
+ "new UiSelector().text(\"Отправка перевода до востребования\"));").click(); | |
// driver.findElementsByClassName("android.widget.EditText"); | |
// driver.findElement(By.id("by.bps.sbol:id/message_edit_text")).sendKeys("Test"); | |
// driver.findElement(By.id("by.bps.sbol:id/send_message_bttn")).click(); | |
// try { | |
// Thread.sleep(10000); | |
// } catch (InterruptedException e) { | |
// e.printStackTrace(); | |
// } | |
// driver.findElement(By.id("by.bps.sbol:id/message_edit_text")).sendKeys("TEST2"); | |
// try { | |
// Thread.sleep(10000); | |
// } catch (InterruptedException e) { | |
// e.printStackTrace(); | |
// } | |
driver.quit(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment