1
+ package dev.selenium.getting_started
2
+
3
+ import org.junit.jupiter.api.Disabled
4
+ import org.junit.jupiter.api.Test
5
+ import org.openqa.selenium.WebDriver
6
+ import org.openqa.selenium.chrome.ChromeDriver
7
+ import org.openqa.selenium.chrome.ChromeOptions
8
+ import org.openqa.selenium.edge.EdgeDriver
9
+ import org.openqa.selenium.edge.EdgeOptions
10
+ import org.openqa.selenium.firefox.FirefoxDriver
11
+ import org.openqa.selenium.firefox.FirefoxOptions
12
+ import org.openqa.selenium.ie.InternetExplorerDriver
13
+ import org.openqa.selenium.ie.InternetExplorerOptions
14
+ import org.openqa.selenium.safari.SafariDriver
15
+ import org.openqa.selenium.safari.SafariOptions
16
+
17
+
18
+ class OpenBrowserTest {
19
+ private lateinit var driver: WebDriver
20
+
21
+ @Test
22
+ fun chromeSession () {
23
+ val options = ChromeOptions ()
24
+ driver = ChromeDriver (options)
25
+ driver.quit()
26
+ }
27
+
28
+ @Test
29
+ fun edgeSession () {
30
+ val options = EdgeOptions ()
31
+ driver = EdgeDriver (options)
32
+ driver.quit()
33
+ }
34
+
35
+ @Test
36
+ fun firefoxSession () {
37
+ val options = FirefoxOptions ()
38
+ driver = FirefoxDriver (options)
39
+ driver.quit()
40
+ }
41
+
42
+ @Disabled(" Only runs on Windows" )
43
+ @Test
44
+ fun internetExplorerSession () {
45
+ val options = InternetExplorerOptions ()
46
+ driver = InternetExplorerDriver (options)
47
+ driver.quit()
48
+ }
49
+
50
+ @Disabled(" Only runs on Windows" )
51
+ @Test
52
+ fun internetExplorerCompatibilitySession () {
53
+ val options = InternetExplorerOptions ()
54
+ options.attachToEdgeChrome()
55
+ options.withEdgeExecutablePath(" /path/to/edge/browser" )
56
+ driver = InternetExplorerDriver (options)
57
+ driver.quit()
58
+ }
59
+
60
+ @Disabled(" Requires non-standard browser" )
61
+ @Test
62
+ fun operaSession () {
63
+ val options = ChromeOptions ()
64
+ options.setBinary(" /path/to/opera/browser" )
65
+ driver = ChromeDriver (options)
66
+ driver.quit()
67
+ }
68
+
69
+ @Disabled(" Only runs on Mac" )
70
+ @Test
71
+ fun safariSession () {
72
+ val options = SafariOptions ()
73
+ driver = SafariDriver (options)
74
+ driver.quit()
75
+ }
76
+ }
0 commit comments