File tree Expand file tree Collapse file tree 1 file changed +18
-6
lines changed
src/test/java/io/github/bonigarcia/wdm/test/opera Expand file tree Collapse file tree 1 file changed +18
-6
lines changed Original file line number Diff line number Diff line change 16
16
*/
17
17
package io .github .bonigarcia .wdm .test .opera ;
18
18
19
+ import static java .nio .file .Files .exists ;
19
20
import static org .apache .commons .lang3 .SystemUtils .IS_OS_MAC ;
20
21
import static org .apache .commons .lang3 .SystemUtils .IS_OS_WINDOWS ;
21
22
import static org .junit .Assume .assumeTrue ;
22
23
23
- import java .io .File ;
24
+ import java .nio .file .Path ;
25
+ import java .nio .file .Paths ;
24
26
25
27
import org .junit .Before ;
26
28
import org .junit .BeforeClass ;
@@ -44,13 +46,23 @@ public static void setupClass() {
44
46
45
47
@ Before
46
48
public void setupTest () {
47
- String opera = IS_OS_WINDOWS
48
- ? "C:\\ Users\\ boni\\ AppData\\ Local\\ Programs\\ Opera\\ launcher.exe"
49
- : IS_OS_MAC ? "/Applications/Opera.app/Contents/MacOS/Opera"
50
- : "/usr/bin/opera" ;
51
- assumeTrue (new File (opera ).exists ());
49
+ Path browserPath = getBrowserPath ();
50
+ assumeTrue (exists (browserPath ));
52
51
53
52
driver = new OperaDriver ();
54
53
}
55
54
55
+ private Path getBrowserPath () {
56
+ Path path ;
57
+ if (IS_OS_WINDOWS ) {
58
+ path = Paths .get (System .getenv ("LOCALAPPDATA" ),
59
+ "/Programs/Opera/launcher.exe" );
60
+ } else if (IS_OS_MAC ) {
61
+ path = Paths .get ("/Applications/Opera.app/Contents/MacOS/Opera" );
62
+ } else {
63
+ path = Paths .get ("/usr/bin/opera" );
64
+ }
65
+ return path ;
66
+ }
67
+
56
68
}
You can’t perform that action at this time.
0 commit comments