当前位置: 动力学知识库 > 问答 > 编程问答 >

java - Is this solution could be good for invalid element state: Element is not currently interactable and may not be manipulated

问题描述:

I face with this InvalidElementStateException from time to time at this spot:

WebElement webElement...

webElement.clear()

So i was thinking about this solution:

 def clearTextFieldAndRecoverFromInvalidElementState(webElement: WebElement): Unit = {

var count = 0

var result = false

breakable {

while (count < 3 && !result) {

try {

webElement.clear()

result = true

} catch {

case e: InvalidElementStateException => println("Trying to recover from a InvalidElementStateException")

count = count + 1

Thread.sleep(2000)

}

}

}

}

分享给朋友:
您可能感兴趣的文章:
随机阅读: