所以我正在研究一个测试项目,我必须在Web驱动程序中一个添加多个实体,并检查Web驱动程序的响应。 我的示例代码是:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim driver As IWebDriver
driver = New ChromeDriver(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location))
goagain:
Dim currententity As String = ListBox1.SelectedItem.ToString
Try
ListBox1.SelectedIndex += 1
Catch ex As Exception
MsgBox("Finished")
Exit Sub
End Try
'put value in web driver
'get the response and analyze it and then
GoTo goagain
代码可以正常运行而不会再次循环(但是),但是当我再次使用go时,Web浏览器会在不分析响应的情况下,继续放置列表框的下一个值(ListBox1.SelectedIndex + = 1)。 附言我尝试添加隐式等待,如:
driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(20)
但是问题仍然存在。