-
Notifications
You must be signed in to change notification settings - Fork 87
Expand file tree
/
Copy pathLink.java
More file actions
42 lines (34 loc) · 957 Bytes
/
Link.java
File metadata and controls
42 lines (34 loc) · 957 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package objects;
import org.openqa.selenium.WebElement;
import java.util.Objects;
public class Link {
private String url;
private String label;
public Link(String url, String label) {
this.url = url;
this.label = label;
}
public Link(WebElement element) {
this.url = element.getAttribute("href");
this.label = element.getText();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Link link = (Link) o;
return Objects.equals(url, link.url) &&
Objects.equals(label, link.label);
}
@Override
public int hashCode() {
return Objects.hash(url, label);
}
@Override
public String toString() {
return "Link{" +
"url='" + url + '\'' +
", label='" + label + '\'' +
'}';
}
}