|
|
@ -80,11 +80,11 @@ public class DevicesPage {
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public ConnectedCupDeviceViewPage viewDevice(String deviceName) throws IOException {
|
|
|
|
public ConnectedCupDeviceViewPage viewDevice(String deviceName) throws IOException {
|
|
|
|
WebElement deviceTable = driver.findElement(By.xpath(uiElementMapper.getElement("iot.devices.table.xpath")));
|
|
|
|
WebElement deviceTable = driver.findElement(By.xpath(uiElementMapper.getElement("iot.devices.table.xpath")));
|
|
|
|
List<WebElement> data = deviceTable.findElements(By.cssSelector("a"));
|
|
|
|
List<WebElement> anchors = deviceTable.findElements(By.cssSelector("a"));
|
|
|
|
for (WebElement e : data) {
|
|
|
|
for (WebElement element : anchors) {
|
|
|
|
String s = getLink(e, "/device/connectedcup?id=");
|
|
|
|
String connectedCupLink = getLink(element, "/device/connectedcup?id=");
|
|
|
|
if (s != null) {
|
|
|
|
if (connectedCupLink != null) {
|
|
|
|
driver.get(s);
|
|
|
|
driver.get(connectedCupLink);
|
|
|
|
return new ConnectedCupDeviceViewPage(driver, deviceName);
|
|
|
|
return new ConnectedCupDeviceViewPage(driver, deviceName);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -100,12 +100,11 @@ public class DevicesPage {
|
|
|
|
private String getLink(WebElement element, String... lookupText) {
|
|
|
|
private String getLink(WebElement element, String... lookupText) {
|
|
|
|
String link = element.getAttribute("href");
|
|
|
|
String link = element.getAttribute("href");
|
|
|
|
boolean check = true;
|
|
|
|
boolean check = true;
|
|
|
|
for (String s : lookupText) {
|
|
|
|
for (String text : lookupText) {
|
|
|
|
if (!link.contains(s)) {
|
|
|
|
if (!link.contains(text)) {
|
|
|
|
check = false;
|
|
|
|
check = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return check ? link : null;
|
|
|
|
return check ? link : null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|