我已经对此进行了编码:
static async waitForButtonToBeEnabledAndThenClickToDownload(id: string, classAttr: string) {
await ElementHelper.isElementDisplayed(CompliancePolicyManagementPage.locatorByIdAndDisabledAttribute(id)).then(function (result) {
for (var i = 0; i <= 10; i++) {
if (result != true) {
CommonPageHelper.clickByIdandClass(id, classAttr);
WaitHelper.getInstance().staticWait(1000);
console.log('Value of Result should be false: ' + result);
break;
}
WaitHelper.getInstance().staticWait(15000);
CommonPageHelper.refreshPage();
console.log('Value of Result: ' + result);
}
});
}
我收到此编译错误:
方法参考不明确:Integer类型的toString()和toString(int)均符合条件
我该如何解决?
答案 0 :(得分:4)
您有两种可能的解决方案:
将其替换为lambda:
this.referenceService.get(id)
.map(ref-> Integer.toString(ref.hashCode()));
this.referenceService.get(id)
.map(Reference::hashCode)
.map(Objects::toString); // this will cal toString method on you hash
编写您自己的方法:
this.referenceService.get(id)
.map(this::toHashString);
private Strign toHashString(Reference ref) {
return Integer.toString(ref.hashCode());
}