@@ -5,7 +5,21 @@ export default function javaTemplatesResource(server: any) {
55 server . addResource ( {
66 uri : 'generate://code-with-locators' ,
77 name : 'Generate Code With Locators' ,
8- description : `Generate code for the current page with locators which was retrieved from generate_locators tool.
8+ description : `Generate code for the current page with locators which was retrieved from generate_locators tool.
9+ The code should be generated in the same priorty order as the locators were generated.
10+ For iOS the priority order is:
11+ 'id',
12+ 'accessibility id',
13+ '-ios predicate string',
14+ '-ios class chain',
15+ 'xpath',
16+ 'class name',
17+ For Android the priority order is:
18+ 'id',
19+ 'accessibility id',
20+ 'xpath',
21+ '-android uiautomator',
22+ 'class name',
923 which follows the page factory pattern. Dont not strictly create test cases, just generate the code for locators.` ,
1024 mimeType : 'text/plain' ,
1125 async load ( ) {
@@ -30,6 +44,7 @@ import java.time.Duration;
3044/**
3145 * This class demonstrates using PageFactory with Appium for cross-platform
3246 * mobile app locators using @AndroidFindBy and @iOSXCUITFindBy annotations.
47+ * Example:
3348 */
3449public class locators {
3550
@@ -42,8 +57,16 @@ public class locators {
4257 */
4358 @AndroidFindBy(accessibility = "username_input")
4459 @iOSXCUITFindBy(accessibility = "username_input")
60+
61+
4562 public WebElement usernameField;
4663
64+ @iOSXCUITFindBy(iOSNsPredicate = "name = 'IntegerB'")
65+ private WebElement textField2;
66+
67+ @iOSXCUITFindBy(iOSClassChain = "XCUIElementTypeWindow/*/XCUIElementTypeTextField[2]")
68+ private WebElement secondTextField;
69+
4770 /**
4871 * Constructor that initializes the PageFactory
4972 *
0 commit comments