thucydides-webtests/thucydides — pull request #130 by azhurbilo (2014-03-17 10:55:08+00:00)
Title: override SmartAjaxElementLocator toString method

override SmartAjaxElementLocator toString method to get access to text of element locator in waitFor methods of WebElementFacadeImpl.

For example I want wait until element with annotation @FindBy(css = ".navbar [href$='/members/login']") be visible for 15 seconds and get message: element with locator By.selector: .navbar [href$='/members/login'] is not visble.

At the moment I use
throw new ElementNotVisibleException("Element with locator ["+locator.toString();+"] is not visible!");

result: "Element with locator ["net.thucydides.core.annotations.locators.SmartAjaxElementLocator@23897e13"] is not visible!"

with overrided toString we get: "Element with locator ["By.selector: .navbar [href$='/members/login']"] is not visible!"

Thus inside WebElementFacadeImpl we can use locator.toString(); to get clear text