All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.epam.jdiuitests.implementation.selenium.elements.common.Link Maven / Gradle / Ivy

The newest version!
/**
 * *************************************************************************
 * Copyright (C) 2014 GGA Software Services LLC
 * 

* This file may be distributed and/or modified under the terms of the * GNU General Public License version 3 as published by the Free Software * Foundation. *

* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. *

* You should have received a copy of the GNU General Public License * along with this program; if not, see . * ************************************************************************* */ package com.epam.jdiuitests.implementation.selenium.elements.common; import com.epam.jdiuitests.implementation.selenium.elements.base.ClickableText; import com.epam.jdiuitests.implementation.selenium.elements.interfaces.common.ILink; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import static com.epam.jdiuitests.core.utils.common.Timer.getByCondition; import static java.lang.String.format; /** * Link control implementation * * @author Roman Iovlev */ public class Link extends ClickableText implements ILink { public Link() { } public Link(By byLocator) { super(byLocator); } public Link(WebElement webElement) { super(webElement); } protected String getReferenceAction() { return getWebElement().getAttribute("href"); } public final String getReference() { return invoker.doJActionResult("Get link reference", this::getReferenceAction, href -> "Get href of link '" + href + "'"); } public final String waitReference(String text) { return invoker.doJActionResult(format("Wait link contains '%s'", text), () -> getByCondition(this::getReferenceAction, t -> t.contains(text))); } public final String waitMatchReference(String regEx) { return invoker.doJActionResult(format("Wait link match regex '%s'", regEx), () -> getByCondition(this::getReferenceAction, t -> t.matches(regEx))); } protected String getTooltipAction() { return getWebElement().getAttribute("title"); } public final String getTooltip() { return invoker.doJActionResult("Get link tooltip", this::getTooltipAction, href -> "Get link tooltip '" + href + "'"); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy