File tree Expand file tree Collapse file tree 3 files changed +32
-0
lines changed
main/java/io/appium/java_client/pagefactory
test/java/io/appium/java_client/pagefactory_tests Expand file tree Collapse file tree 3 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -88,6 +88,18 @@ By getBy(Annotation annotation) {
8888By getBy (Annotation annotation ) {
8989return By .xpath (getValue (annotation , this ));
9090}
91+ },
92+ BYLINKTEXT ("linkText" ) {
93+ @ Override
94+ By getBy (Annotation annotation ) {
95+ return By .linkText (getValue (annotation , this ));
96+ }
97+ },
98+ BYPARTIALLINKTEXT ("partialLinkText" ) {
99+ @ Override
100+ By getBy (Annotation annotation ) {
101+ return By .partialLinkText (getValue (annotation , this ));
102+ }
91103};
92104
93105private final String valueName ;
Original file line number Diff line number Diff line change 2121String className () default "" ;
2222String tagName () default "" ;
2323String xpath () default "" ;
24+ String linkText () default "" ;
25+ String partialLinkText () default "" ;
2426}
Original file line number Diff line number Diff line change @@ -65,6 +65,12 @@ public class SelendroidModeTest {
6565
6666 @ SelendroidFindBy (tagName = "TextView" )
6767 private WebElement textTag ;
68+
69+ @ SelendroidFindBy (linkText = "Accessibility" )
70+ private WebElement textLink ;
71+
72+ @ SelendroidFindBy (partialLinkText = "ccessibilit" )
73+ private WebElement textPartialLink ;
6874
6975@ Before
7076 public void setUp () throws Exception {
@@ -140,9 +146,21 @@ public void findByElementByCalssTest() {
140146 public void findByElementByTagTest () {
141147 Assert .assertNotEquals (null , textTag .getAttribute ("text" ));
142148 }
149+
143150 @ Test
144151 public void findBySelendroidAnnotationOnlyTest () {
145152 Assert .assertNotEquals (null , textSelendroidId .getAttribute ("text" ));
146153 }
154+
155+ @ Test
156+ public void findBySelendroidLinkTextTest () {
157+ Assert .assertEquals ("Accessibility" , textLink .getText ());
158+
159+ }
160+
161+ @ Test
162+ public void findBySelendroidPartialLinkTextTest () {
163+ Assert .assertEquals ("Accessibility" , textPartialLink .getText ());
147164
165+ }
148166}
You can’t perform that action at this time.
0 commit comments