Skip to content

Commit 8fc9a82

Browse files
#565: the WIKI was updated
1 parent 8472b4f commit 8fc9a82

File tree

1 file changed

+62
-1
lines changed

1 file changed

+62
-1
lines changed

docs/Page-objects.md

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ RemoteWebElement someElement;
145145
List<RemoteWebElement> someElements;
146146
```
147147

148-
## Also possible combined variants:
148+
## Also possible combined variants for target platforms:
149149

150150
```java
151151
import org.openqa.selenium.remote.RemoteWebElement;
@@ -194,6 +194,67 @@ RemoteWebElement someElement;
194194
List<RemoteWebElement> someElements;
195195
```
196196

197+
## Mixed chain/any locator strategy
198+
199+
Some locator-element could not be defined certainly sometimes. It may be defined as one of possible variants/chained locator.
200+
If the using of _xpath_ is not convenient for some reasons so there are possible use cases
201+
202+
### the chained searching
203+
204+
```java
205+
import org.openqa.selenium.remote.RemoteWebElement;
206+
import io.appium.java_client.pagefactory.*;
207+
import org.openqa.selenium.support.FindBys;
208+
import org.openqa.selenium.support.FindBy;
209+
210+
//it is necessary to define priorities at this case. The lower number means the higher priority.
211+
//The default value is 0 (the highest priority)
212+
@iOSFindBy(someStrategy1)
213+
@iOSFindAll(value = {@iOSBy(subloctor1), @iOSBy(subloctor1)}, priority = 1) //there are some variants for
214+
// this element at the chain
215+
@iOSFindBy(someStrategy2, priority = 2)
216+
@iOSFindBy(someStrategy3, priority = 3)
217+
RemoteWebElement someElement;
218+
219+
220+
@iOSFindBy(someStrategy1)
221+
@iOSFindAll(value = {@iOSBy(subloctor1), @iOSBy(subloctor1)}, priority = 1) //there are some variants for
222+
// this element at the chain
223+
@iOSFindBy(someStrategy2, priority = 2)
224+
@iOSFindBy(someStrategy3, priority = 3)
225+
List<RemoteWebElement> someElements;
226+
```
227+
228+
### all possible
229+
230+
```java
231+
import org.openqa.selenium.remote.RemoteWebElement;
232+
import io.appium.java_client.pagefactory.*;
233+
import org.openqa.selenium.support.FindBys;
234+
import org.openqa.selenium.support.FindBy;
235+
236+
//it is not necessary to define priorities at this case. But it can manage the searching.
237+
//The lower number means the higher priority.
238+
//The default value is 0 (the highest priority)
239+
@HowToUseLocators(iOSAutomation = ALL_POSSIBLE)
240+
@iOSFindBy(someStrategy1)
241+
@iOSFindBys(value = {@iOSBy(subloctor1), @iOSBy(subloctor1)}, priority = 1) //this possible variant is
242+
// the chain
243+
@iOSFindBy(someStrategy2, priority = 2)
244+
@iOSFindBy(someStrategy3, priority = 3)
245+
RemoteWebElement someElement;
246+
247+
248+
249+
@HowToUseLocators(iOSAutomation = ALL_POSSIBLE)
250+
@iOSFindBy(someStrategy1)
251+
@iOSFindBys(value = {@iOSBy(subloctor1), @iOSBy(subloctor1)}, priority = 1) //this possible variant is
252+
// the chain
253+
@iOSFindBy(someStrategy2, priority = 2)
254+
@iOSFindBy(someStrategy3, priority = 3)
255+
List<RemoteWebElement> someElements;
256+
```
257+
197258
# Appium Java client is integrated with Selenium PageFactory by AppiumFieldDecorator.
198259

199260
Object fields are populated as below:

0 commit comments

Comments
 (0)