Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,16 @@ public static By linkText(final String selector) {
return By.linkText(selector);
}

/**
* Returns a By locator for a partial link text.
*
* @param selector the name, corresponding to the value of one or several elements' link text
* @return the By locator corresponding to that selector
*/
public static By partialLinkText(final String selector) {
return By.partialLinkText(selector);
}

/**
* Returns a By locator for specified accessibility ID. Mobile-only.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ public enum Strategy {
TAGNAME("By.tagName", LocatedBy::tagName),
/** Locate by Link Text */
LINKTEXT("By.linkText", LocatedBy::linkText),
/** Locate by Parial Link Text */
PARTIAL_LINKTEXT("By.partialLinkText", LocatedBy::partialLinkText),
/** Locate by Accessibility ID */
ACCESSIBILITYID("By.AccessibilityId", LocatedBy::accessibilityId),
/** Locate using Android UI Automator */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,18 @@ public void testLinkText() {
assertEquals(by.toString(), "By.linkText: test");
}

@Test
public void testPartialLinkText() {
logger.info("STEP 1: Create a new By with partial link text selector \"est\".");
By by = LocatedBy.partialLinkText("est");

logger.info("STEP 2: Assert that we got a ByPartialLinkText.");
assertTrue(by instanceof By.ByPartialLinkText);

logger.info("STEP 3: Assert that it has selector \"est\".");
assertEquals(by.toString(), "By.partialLinkText: est");
}

@Test
public void testAccessibilityId() {
logger.info("STEP 1: Create a new By with accessibility ID selector \"test\".");
Expand Down