Skip to content

Commit 44707e7

Browse files
author
heraclmene
committed
Change to defer
1 parent 9582041 commit 44707e7

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

examples/getting-started/main.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ func main() {
2727
return
2828
}
2929

30+
// Defer the deletion of the session.
31+
defer driver.DeleteSession()
32+
3033
// Navigate to Google.
3134
_, err = driver.Go("https://www.google.com")
3235
if err != nil {
@@ -35,10 +38,4 @@ func main() {
3538

3639
// Hooray, we navigated to Google!
3740
fmt.Println("Successfully navigated to Google!")
38-
39-
// Delete the session to ensure the Selenium hub doesn't fall over.
40-
_, err = driver.DeleteSession()
41-
if err != nil {
42-
fmt.Println(err)
43-
}
4441
}

0 commit comments

Comments
 (0)