更新时间:2021-12-17 14:41:52
以下是对我有用的解决方案:
Here's the solution that worked for me:
我已将代码发布在&有效.它可能需要改进,但现在我很高兴,因为我不是一名硬核程序员.
I have posted the code below & it worked. It may need refinement but for now I am happy as I am not a hardcore programmer.
现在假设小时数取决于您的测试
Now assume that hour is variable depending upon your test
// change hour
@SuppressWarnings("unchecked")
List<WebElement> buttons = driver.findElementsByClassName("android.widget.Button");
MobileElement hour = (MobileElement) buttons.get(0);
List<WebElement> highlights = driver.findElementsByClassName("android.widget.EditText");
MobileElement hourHighlight = (MobileElement) highlights.get(0); // highlighted hour
// lets say we need hour = 4
while (!hourHighlight.getText().equalsIgnoreCase("4"))
{
Thread.sleep(100);
if (hourHighlight.getText().equalsIgnoreCase("4"))
{
break;
}
hour.tap(1, 10);
}