@iOSXCUITFindBy(id = "Pair")
private WebElement pairPLUBTN;
@iOSXCUITFindBy(iOSNsPredicate = "label == 'Cancel'")
private WebElement cancelPairPLUBTN;
private By pairingTextBox = By.xpath("//XCUIElementTypeStaticText[contains(@name,'would like to pair with your iPhone.')]");
String expectedPLUTOConnect = "SaverOne_System_84B3";
private boolean doStop = false;
AppiumDriver driver;
public RunnableToDeclinePairingRequests(AppiumDriver driver) {
super();
this.driver = driver;
}
public synchronized void doStop() {
this.doStop = true;
}
private synchronized boolean keepRunning() {
return this.doStop == false;
}
public void run() {
while (keepRunning()) {
try {
System.out.println("text 1 : " +driver.findElement(By.xpath("//XCUIElementTypeStaticText[contains(@name,'would like to pair with your iPhone.')]")).getText());
String text = driver.switchTo().alert().getText();
System.out.println("text 2 : "+text);
if (text.contains(expectedPLUTOConnect)) {
System.out.println("stam 1");
tapOnElement(pairPLUBTN);
System.out.println("clicked pair");
} else {
System.out.println("stam");
cancelPairPLUBTN.click();
tapOnElement(cancelPairPLUBTN);
System.out.println("clicked cancel");
}
} catch (Exception e) {
System.out.println("no element ");
}
Uninterruptibles.sleepUninterruptibly(1, TimeUnit.SECONDS);
}
}
for now I didn’t succeded to click on pair / cancel, because the print of “stam / stam 1” I see
@Aleksei any update?