-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5409 from jdi-testing/master
sync master
- Loading branch information
Showing
11 changed files
with
68 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
jdi-light-core/src/main/java/com/epam/jdi/light/elements/interfaces/base/HasLink.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.epam.jdi.light.elements.interfaces.base; | ||
|
||
import com.epam.jdi.light.common.JDIAction; | ||
|
||
import java.net.MalformedURLException; | ||
import java.net.URL; | ||
|
||
import static com.epam.jdi.light.common.Exceptions.runtimeException; | ||
import static com.jdiai.tools.LinqUtils.safeException; | ||
|
||
public interface HasLink extends ICoreElement { | ||
@JDIAction("Get if there is link inside the button") | ||
default boolean hasLink() { | ||
return core().hasAttribute("href"); | ||
} | ||
|
||
@JDIAction("Get '{name}' reference") | ||
default String ref() { | ||
return core().attr("href"); | ||
} | ||
|
||
@JDIAction("Get '{name}' reference as URL") | ||
default URL url() { | ||
try { | ||
return new URL(ref()); | ||
} catch (MalformedURLException ex) { | ||
throw runtimeException(safeException(ex)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
import com.epam.jdi.light.common.JDIAction; | ||
import com.epam.jdi.light.elements.base.UIBaseElement; | ||
import com.epam.jdi.light.elements.interfaces.base.HasClick; | ||
import com.epam.jdi.light.elements.interfaces.base.HasLink; | ||
import com.epam.jdi.light.elements.interfaces.base.HasValue; | ||
import com.epam.jdi.light.elements.interfaces.common.IsText; | ||
import com.epam.jdi.light.ui.html.asserts.LinkAssert; | ||
|
@@ -19,19 +20,8 @@ | |
* Email: [email protected]; Skype: roman.iovlev | ||
*/ | ||
public class Link extends UIBaseElement<LinkAssert> | ||
implements HasValue, HasClick, IsText { | ||
implements HasValue, HasClick, IsText, HasLink { | ||
// region Actions | ||
|
||
@JDIAction(value = "Get '{name}' reference", level = DEBUG) | ||
public String ref() { return core().attr("href"); } | ||
|
||
public URL url() { | ||
try { | ||
return new URL(ref()); | ||
} catch (MalformedURLException ex) { | ||
throw runtimeException(safeException(ex)); | ||
} | ||
} | ||
@JDIAction(value = "Get '{name}' image alt", level = DEBUG) | ||
public String alt() { return core().attr("alt"); } | ||
// endregion | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters