File tree 3 files changed +12
-1
lines changed
java/com/udemy/spring/springselenium
3 files changed +12
-1
lines changed Original file line number Diff line number Diff line change 3
3
import io .github .bonigarcia .wdm .WebDriverManager ;
4
4
import org .openqa .selenium .WebDriver ;
5
5
import org .openqa .selenium .chrome .ChromeDriver ;
6
+ import org .openqa .selenium .firefox .FirefoxDriver ;
6
7
import org .openqa .selenium .support .ui .WebDriverWait ;
7
8
import org .springframework .beans .factory .annotation .Value ;
9
+ import org .springframework .boot .autoconfigure .condition .ConditionalOnMissingBean ;
10
+ import org .springframework .boot .autoconfigure .condition .ConditionalOnProperty ;
8
11
import org .springframework .context .annotation .Bean ;
9
12
import org .springframework .context .annotation .Configuration ;
10
13
import org .springframework .context .annotation .Lazy ;
@@ -17,6 +20,14 @@ public class WebDriverConfig {
17
20
private int timeout ;
18
21
19
22
@ Bean
23
+ @ ConditionalOnProperty (name = "browser" , havingValue = "firefox" )
24
+ public WebDriver firefoxDriver (){
25
+ WebDriverManager .firefoxdriver ().setup ();
26
+ return new FirefoxDriver ();
27
+ }
28
+
29
+ @ Bean
30
+ @ ConditionalOnMissingBean
20
31
public WebDriver chromeDriver (){
21
32
WebDriverManager .chromedriver ().version ("77.0.3865.40" ).setup ();
22
33
return new ChromeDriver ();
Original file line number Diff line number Diff line change 8
8
import org .springframework .stereotype .Component ;
9
9
import org .springframework .util .FileCopyUtils ;
10
10
11
- import javax .annotation .PostConstruct ;
12
11
import java .io .File ;
13
12
import java .io .IOException ;
14
13
import java .nio .file .Path ;
Original file line number Diff line number Diff line change 1
1
application.url =https://www.google.com
2
2
screenshot.path =/home/vins/Documents/udemy/temp
3
+ browser =firefox
You can’t perform that action at this time.
0 commit comments