2016-08-17 123 views

回答

1

您可以使用元素(locator).getText()來獲取元素的文本。你可以使用下面的代碼片段:

var targetElement=element(by.css("ul>li:nth-child(5)")); 
    targetElement.getText().then(function (txt) { 
     var textToSplit=txt.split(":"); 
     console.log("Text is : "+textToSplit[1]); 
    }); 
+0

謝謝蘇雷什。它的工作:) – Loc