- WebDriverWait wait = new WebDriverWait(getDriver(), WEB_DRIVER_WAIT_TIME_OUT);
- return wait.until(ExpectedConditions.presenceOfAllElementsLocatedBy(By.xpath(String.format("//*[contains(@data-tests-id, '", dataTestId, "')]"))));
- } catch (Exception e) {
- return new ArrayList<WebElement>();
+ final WebDriverWait wait = new WebDriverWait(getDriver(), WEB_DRIVER_WAIT_TIME_OUT);
+ final String xpath = String.format("//*[contains(@%s, '%s')]", TEST_ID_ATTRIBUTE_NAME, dataTestId);
+ return wait.until(ExpectedConditions.presenceOfAllElementsLocatedBy(By.xpath(xpath)));
+ } catch (final Exception e) {
+ final String message = String.format("Could not find element containing the attribute '%s' as '%s'",
+ TEST_ID_ATTRIBUTE_NAME, dataTestId);
+ LOGGER.debug(message, e);
+ return Collections.emptyList();