Hi,
I want to find some elements which share the prefix "pre " but has different suffixes.
i.e. elements ids are: “pre elem1” and “pre elem2”.
I want to be able to find each of them separately.
Could someone give me a hand with this?
Thanks.
Hi,
I want to find some elements which share the prefix "pre " but has different suffixes.
i.e. elements ids are: “pre elem1” and “pre elem2”.
I want to be able to find each of them separately.
Could someone give me a hand with this?
Thanks.
example with predicate:
@iOSXCUITFindBy(iOSNsPredicate = "type == 'XCUIElementTypeStaticText' AND name BEGINSWITH 'pre '")
private List<IOSElement> yourList;
Thanks for the quick response,
How can I use without @iOS… ?
I mean something like that:
driver.findElement(By…)
@BB here your way:
driver.findElements(MobileBy.iOSNsPredicateString("type == 'XCUIElementTypeStaticText' AND name BEGINSWITH 'pre '"));
It doesn’t seem to work…
It doesn’t recognize “.iOSNsPredicateString”
Do you know what could be the reason for that?
your java-client version is OLD
Thanks a lot @Aleksei! I appreciate it.
Can we use ios_predicate with Ruby client?
My Java Client was up to date…
Can you tell me what to import?
mine java-client version:
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>5.0.0-BETA8</version>
</dependency>
to import it is:
import io.appium.java_client.MobileBy;
Sorry, but I can’t find anything related to ios predicate there.
@gajeshwar next try - see end https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/ios_predicate.md
Thanks for your help @Aleksei but that also didn’t work with iOS 10.* using
Appium 1.6.4.
I am doubtful whethet we have added predicate support in newer ruby library
or not.
@Aleksei …What should I import to use : iOSXCUITFindBy ?
And maybe the reason I can’t find those methods is that I use Java?
10x
@gajeshwar you need look into Appium logs to check how it sending with ruby.
@BB
import io.appium.java_client.pagefactory.iOSXCUITFindBy;
Sorry but how can I check appium logs since I couldn’t execute those commands at all.
@Aleksei
I have one of this in my code which is working fine…
@iOSXCUITFindBy(iOSNsPredicate = “type == ‘XCUIElementTypeButton’ AND visible == 1 AND (name == ‘Allow Once’ OR name == ‘Allow’ OR name == ‘OK’)”)
private WebElement acctAlert;
Now I need to accommodate another type, ‘XCUIElementTypeOther’ along with the existing ‘XCUIElementTypeButton’.
How can I do that ?
Thanks for your response.
@iOSXCUITFindBy(iOSNsPredicate = “(type == ‘XCUIElementTypeButton’ OR type == ‘ XCUIElementTypeOther’ ) AND visible == 1 AND (name == ‘Allow Once’ OR name == ‘Allow’ OR name == ‘OK’)”)
private WebElement acctAlert;
Thanks @Aleksei, but it did not work. I got this error.
Caused by: org.openqa.selenium.NoSuchElementException: Can’t locate an element by this strategy: By.chained({AppiumBy.iOSNsPredicate: (type == ‘XCUIElementTypeButton’ OR type == ‘ XCUIElementTypeOther’ ) AND visible == 1 AND (name == ‘Allow While Using App’ OR name == ‘Allow’ OR name == ‘OK’)})
I think I would try
@iOSXCUITFindBy(iOSNsPredicate = “(type == ‘XCUIElementTypeButton’ OR ‘ XCUIElementTypeOther’ ) AND visible == 1 AND (name == ‘Allow Once’ OR name == ‘Allow’ OR name == ‘OK’)”)
private WebElement acctAlert;
I will let you know.
Thanks,