1. import java.util.List;
  2. import org.openqa.selenium.WebElement;
  3. import org.openqa.selenium.support.FindBy;
  4. import ru.yandex.qatools.htmlelements.annotations.Block;
  5. import core.htmlelements.AnyBar;
  6. import core.htmlelements.ExtendedButton;
  7. //There is a tool bar for any document
  8. @Block(@FindBy(id="docs-primary-toolbars"))
  9. public class DocumentToolBar extends AnyBar {
  10. //this buttons are defined by its 'data-tooltip' attribute value
  11. public static class DataToolTipButton extends ExtendedButton {
  12. public DataToolTipButton(WebElement wrappedElement) {
  13. super(wrappedElement);
  14. }
  15. @Override
  16. public String getCaption() {
  17. return getWrappedElement().getAttribute("data-tooltip");
  18. }
  19. }
  20. @FindBy(xpath = ".//*[@id='docs-toolbar']/div")
  21. private List<DataToolTipButton> buttons;
  22. @Override
  23. public void clickButton(String buttonHint) {
  24. findAndClick(buttons, buttonHint);
  25. }
  26. }
Comments powered by Disqus