Private Sub Test_Assert()
On Error GoTo ErrHandle
Dim driver As New ChromeDriver
Dim Assert As New Assert
driver.Get "https://www.google.co.jp"
Assert.Equals "Google", driver.title
Assert.Contains "Goo", driver.title
Assert.Matches "Googl*", driver.title
Assert.NotEquals "google", driver.title
Assert.NotMatches "goog", driver.title
Assert.Fail
ErrHandle:
Debug.Print Err.Description
driver.Quit
End Sub
Handle_Checkbox
Private Sub Handle_Checkbox()
Dim Assert As New selenium.Assert
Dim driver As New ChromeDriver
driver.Get "https://the-internet.herokuapp.com/checkboxes"
Dim cb As WebElement
Set cb = driver.FindElementByCss("#checkboxes input:nth-of-type(2)") 'チェックボックス2のElemnt取得
Assert.True cb.IsSelected 'チェックボックスにチェックが入っているか確認
driver.Wait 2000
cb.Click 'チェックボックスをクリック(チェックを外す)
driver.Wait 2000
Assert.False cb.IsSelected 'チェックボックスのチェックが外れているかか確認
Stop
driver.Quit
End Sub