我正在尝试刷新页面,当我试图找到的元素没有显示时,我已经编写了这段代码,而不是仅仅跳过if语句,测试失败了
while (true)
{
if (Driver.Instance.FindElement(By.LinkText("Leather Utility Vest")).Displayed)
{
var clickButton = Driver.Instance.FindElement(By.LinkText("Leather Utility Vest"));
clickButton.Click();
break;
}
Driver.Instance.Navigate().Refresh();
}
答案 0 :(得分:1)
我刚刚使用此代码
mask = df.isnull()
m1 = mask.iloc[:, np.r_[0:5,9:14]].all(1)
m2 = mask.iloc[:, np.r_[0:11,15:17]].all(1)
m3 = mask.iloc[:, np.r_[3:8,12:17]].all(1)
m = m1 | m2 | m3
print (m)
0 True
1 False
2 True
3 True
4 True
dtype: bool
df = df[~m]
print (df)
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 \
1 6.0 2.0 4.0 1.0 5.0 3.0 4.0 4.0 3.0 7.0 1.0 1.0 7.0 7.0 0.0
15 16 17
1 2.0 9.0 9
这会捕获找不到元素的错误,这就是测试失败的原因并运行了刷新网页的catch块