-
-
Notifications
You must be signed in to change notification settings - Fork 761
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#565 FIX #646
#565 FIX #646
Changes from 8 commits
02a1852
d447014
6c85323
29336b8
69ab315
8472b4f
8fc9a82
5a51da0
a736259
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -145,7 +145,7 @@ RemoteWebElement someElement; | |
List<RemoteWebElement> someElements; | ||
``` | ||
|
||
## Also possible combined variants: | ||
## Also possible combined variants for target platforms: | ||
|
||
```java | ||
import org.openqa.selenium.remote.RemoteWebElement; | ||
|
@@ -194,6 +194,67 @@ RemoteWebElement someElement; | |
List<RemoteWebElement> someElements; | ||
``` | ||
|
||
## Mixed chain/any locator strategy | ||
|
||
Some locator-element could not be defined certainly sometimes. It may be defined as one of possible variants/chained locator. | ||
If the using of _xpath_ is not convenient for some reasons so there are possible use cases | ||
|
||
### the chained searching | ||
|
||
```java | ||
import org.openqa.selenium.remote.RemoteWebElement; | ||
import io.appium.java_client.pagefactory.*; | ||
import org.openqa.selenium.support.FindBys; | ||
import org.openqa.selenium.support.FindBy; | ||
|
||
//it is necessary to define priorities at this case. The lower number means the higher priority. | ||
//The default value is 0 (the highest priority) | ||
@iOSFindBy(someStrategy1) | ||
@iOSFindAll(value = {@iOSBy(subloctor1), @iOSBy(subloctor1)}, priority = 1) //there are some variants for | ||
// this element at the chain | ||
@iOSFindBy(someStrategy2, priority = 2) | ||
@iOSFindBy(someStrategy3, priority = 3) | ||
RemoteWebElement someElement; | ||
|
||
|
||
@iOSFindBy(someStrategy1) | ||
@iOSFindAll(value = {@iOSBy(subloctor1), @iOSBy(subloctor1)}, priority = 1) //there are some variants for | ||
// this element at the chain | ||
@iOSFindBy(someStrategy2, priority = 2) | ||
@iOSFindBy(someStrategy3, priority = 3) | ||
List<RemoteWebElement> someElements; | ||
``` | ||
|
||
### all possible | ||
|
||
```java | ||
import org.openqa.selenium.remote.RemoteWebElement; | ||
import io.appium.java_client.pagefactory.*; | ||
import org.openqa.selenium.support.FindBys; | ||
import org.openqa.selenium.support.FindBy; | ||
|
||
//it is not necessary to define priorities at this case. But it can manage the searching. | ||
//The lower number means the higher priority. | ||
//The default value is 0 (the highest priority) | ||
@HowToUseLocators(iOSAutomation = ALL_POSSIBLE) | ||
@iOSFindBy(someStrategy1) | ||
@iOSFindAll(value = {@iOSBy(subloctor1), @iOSBy(subloctor1)}, priority = 1) //this possible variant is | ||
// the chain | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we update this section as below please?
ALL_POSSIBLE contains CHAIN There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes |
||
@iOSFindBy(someStrategy2, priority = 2) | ||
@iOSFindBy(someStrategy3, priority = 3) | ||
RemoteWebElement someElement; | ||
|
||
|
||
|
||
@HowToUseLocators(iOSAutomation = ALL_POSSIBLE) | ||
@iOSFindBy(someStrategy1) | ||
@iOSFindAll(value = {@iOSBy(subloctor1), @iOSBy(subloctor1)}, priority = 1) //this possible variant is | ||
// the chain | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here too. |
||
@iOSFindBy(someStrategy2, priority = 2) | ||
@iOSFindBy(someStrategy3, priority = 3) | ||
List<RemoteWebElement> someElements; | ||
``` | ||
|
||
# Appium Java client is integrated with Selenium PageFactory by AppiumFieldDecorator. | ||
|
||
Object fields are populated as below: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* See the NOTICE file distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.appium.java_client.pagefactory; | ||
|
||
/** | ||
* Used to build a complex android automator locator. | ||
*/ | ||
public @interface AndroidBy { | ||
/** | ||
* It is an is Android UIAutomator string. | ||
* Read http://developer.android.com/intl/ru/tools/testing-support-library/ | ||
* index.html#uia-apis | ||
*/ | ||
String uiAutomator() default ""; | ||
|
||
/** | ||
* It an UI automation accessibility Id which is a convenient to Android. | ||
* About Android accessibility | ||
* https://developer.android.com/intl/ru/training/accessibility/accessible-app.html | ||
*/ | ||
String accessibility() default ""; | ||
|
||
/** | ||
* It is an id of the target element. | ||
*/ | ||
String id() default ""; | ||
|
||
/** | ||
* It is a className of the target element. | ||
*/ | ||
String className() default ""; | ||
|
||
/** | ||
* It is a desired element tag. | ||
*/ | ||
String tagName() default ""; | ||
|
||
/** | ||
* It is a xpath to the target element. | ||
*/ | ||
String xpath() default ""; | ||
|
||
/** | ||
* @return priority of the searching. Higher number means lower priority. | ||
*/ | ||
int priority() default 0; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package io.appium.java_client.pagefactory; | ||
|
||
import static java.lang.annotation.ElementType.FIELD; | ||
import static java.lang.annotation.ElementType.TYPE; | ||
import static java.lang.annotation.RetentionPolicy.RUNTIME; | ||
|
||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.Target; | ||
|
||
/** | ||
* Defines set of chained/possible locators. Each one locator | ||
* should be defined with {@link AndroidFindAll} | ||
*/ | ||
@Target(value = {TYPE, FIELD}) | ||
@Retention(value = RUNTIME) | ||
public @interface AndroidFindByAllSet { | ||
/** | ||
* @return an array of {@link AndroidFindAll} which builds a sequence of | ||
* the chained searching for elements or a set of possible locators | ||
*/ | ||
AndroidFindAll[] value(); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package io.appium.java_client.pagefactory; | ||
|
||
import static java.lang.annotation.ElementType.FIELD; | ||
import static java.lang.annotation.ElementType.TYPE; | ||
import static java.lang.annotation.RetentionPolicy.RUNTIME; | ||
|
||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.Target; | ||
|
||
/** | ||
* Defines set of chained/possible locators. Each one locator | ||
* should be defined with {@link io.appium.java_client.pagefactory.AndroidFindBys} | ||
*/ | ||
@Target(value = {TYPE, FIELD}) | ||
@Retention(value = RUNTIME) | ||
public @interface AndroidFindByChainSet { | ||
/** | ||
* @return an array of {@link io.appium.java_client.pagefactory.AndroidFindBys} which builds a sequence of | ||
* the chained searching for elements or a set of possible locators | ||
*/ | ||
AndroidFindBys[] value(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CHAINING Contains ALL_POSSIBLE. Awesome👍