File tree Expand file tree Collapse file tree 3 files changed +24
-0
lines changed
auto-sdk-java-page-object/src
main/java/com/applause/auto/pageobjectmodel
test/java/com/applause/auto/pageobjectmodel/base Expand file tree Collapse file tree 3 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -139,6 +139,16 @@ public static By linkText(final String selector) {
139139 return By .linkText (selector );
140140 }
141141
142+ /**
143+ * Returns a By locator for a partial link text.
144+ *
145+ * @param selector the name, corresponding to the value of one or several elements' link text
146+ * @return the By locator corresponding to that selector
147+ */
148+ public static By partialLinkText (final String selector ) {
149+ return By .partialLinkText (selector );
150+ }
151+
142152 /**
143153 * Returns a By locator for specified accessibility ID. Mobile-only.
144154 *
Original file line number Diff line number Diff line change @@ -44,6 +44,8 @@ public enum Strategy {
4444 TAGNAME ("By.tagName" , LocatedBy ::tagName ),
4545 /** Locate by Link Text */
4646 LINKTEXT ("By.linkText" , LocatedBy ::linkText ),
47+ /** Locate by Parial Link Text */
48+ PARTIAL_LINKTEXT ("By.partialLinkText" , LocatedBy ::partialLinkText ),
4749 /** Locate by Accessibility ID */
4850 ACCESSIBILITYID ("By.AccessibilityId" , LocatedBy ::accessibilityId ),
4951 /** Locate using Android UI Automator */
Original file line number Diff line number Diff line change @@ -149,6 +149,18 @@ public void testLinkText() {
149149 assertEquals (by .toString (), "By.linkText: test" );
150150 }
151151
152+ @ Test
153+ public void testPartialLinkText () {
154+ logger .info ("STEP 1: Create a new By with partial link text selector \" est\" ." );
155+ By by = LocatedBy .partialLinkText ("est" );
156+
157+ logger .info ("STEP 2: Assert that we got a ByPartialLinkText." );
158+ assertTrue (by instanceof By .ByPartialLinkText );
159+
160+ logger .info ("STEP 3: Assert that it has selector \" est\" ." );
161+ assertEquals (by .toString (), "By.partialLinkText: est" );
162+ }
163+
152164 @ Test
153165 public void testAccessibilityId () {
154166 logger .info ("STEP 1: Create a new By with accessibility ID selector \" test\" ." );
You can’t perform that action at this time.
0 commit comments