我有由中继器选择的元素选择器。我正进入(状态
$186
Cost
从
element.getText().then(function (balance) {
console.log(balance);
});
我只需要选择 186 美元,我试图通过使用first();
该元素来获得。和余额[0]。但没有找到解决方案。请建议。
我有由中继器选择的元素选择器。我正进入(状态
$186
Cost
从
element.getText().then(function (balance) {
console.log(balance);
});
我只需要选择 186 美元,我试图通过使用first();
该元素来获得。和余额[0]。但没有找到解决方案。请建议。
如果元素存在于 DOM 中,如下所示:
<span ng-repeat="record in records">$186</span><span ng-repeat="record in records">Cost</span>
然后下面的代码工作:
element.all(by.repeater('record in records')).get(0).getText().then(function(txt) {
console.log('txt:'+txt);
});
从字符串中的元素存储中获取文本后。找到所需的子字符串,因为您知道该模式。
var res = str.substring(0, 4);//Change as per the pattern or use regex if required.