Skip to content

Commit

Permalink
Merge pull request #27 from amikhalc/master
Browse files Browse the repository at this point in the history
[WIP] adjust xpath correction
  • Loading branch information
Mike Reiche authored Apr 21, 2021
2 parents 9f05ac6 + 1dcdeb0 commit fab7feb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,11 @@ public GuiElement getSubElement(Locate locate) {
// input --> ./input
// ./input --> No corrections
// .//input --> No corrections
// (//input) --> No corrections
if (xpath.startsWith("/")) {
xpath = xpath.replaceFirst("/", "./");
} else if (xpath.startsWith("(")) {
// do nothing with grouped xPathes
} else if (!xpath.startsWith(".")) {
xpath = "./" + xpath;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,14 @@ public void testT02_SensibleData() {
LogAssertUtils.assertEntryNotInLogFile("pageobjects.GuiElement - type \"testT02_SensibleData\" on By.id: 1");
}

@Test
public void testT03_GetElementsWithParenthesisInXpath() {
final WebDriver driver = WebDriverManager.getWebDriver();
GuiElement box = new GuiElement(driver, By.xpath("//div[@class='box'][1]"));
GuiElement subElement = box.getSubElement(By.xpath("(//input[@id='2'])"));

subElement.asserts().assertIsPresent();

}

}

0 comments on commit fab7feb

Please sign in to comment.