我想从另一个类访问Form1类Selenium,但是
这里的问题是每当执行Form1硒访问另一个实例时执行。
我只想只使用一个实例。
有人启发我,万分感谢
Public Class Form1
Public service As ChromeDriverService = ChromeDriverService.CreateDefaultService
Public chromeOptions As New OpenQA.Selenium.Chrome.ChromeOptions()
Public driver As New OpenQA.Selenium.Chrome.ChromeDriver(chromeOptions)
Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles btnCollect.Click
' i only want to run one webdriver session not multiple session.
Monitoring.test()
Monitoring2.test2()
End Sub
end class
Public Class Monitoring
public sub test()
driver.Navigate().GoToUrl("https://www.google.com")
end sub
end class
Public Class Monitoring2
public sub test2()
driver.Navigate().GoToUrl("https://www.yahoo.com")
end sub
end class