Skip to content

Commit d4fd8e6

Browse files
author
christopher.mbaike
committed
rearrange the structure of bean class
1 parent d84f5b1 commit d4fd8e6

File tree

1 file changed

+12
-13
lines changed
  • src/test/java/com/techboy/selenium/beanconfig

1 file changed

+12
-13
lines changed

src/test/java/com/techboy/selenium/beanconfig/Beans.java

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import org.openqa.selenium.Proxy;
66
import org.springframework.context.annotation.*;
77
import org.springframework.core.type.AnnotatedTypeMetadata;
8-
import org.springframework.stereotype.Component;
98

109
import javax.annotation.PostConstruct;
1110
import java.io.File;
@@ -17,7 +16,6 @@
1716
* Created by christopher on 01/12/2015.
1817
*/
1918
@Configuration
20-
@Component
2119
public class Beans {
2220

2321
String workingDir = System.getProperty("user.dir");
@@ -29,6 +27,18 @@ public class Beans {
2927
private static String browser = System.getProperty("browser", "chrome");
3028

3129

30+
@PostConstruct
31+
public void systemPath() throws IOException {
32+
if (workingOS.contains("windows")) {
33+
System.setProperty("webdriver.chrome.driver", new File(".").getCanonicalPath()+"/src/test/resources/selenium_browser_drivers/windowsChromedriver/chromedriver.exe");
34+
} else if (workingOS.contains("mac")) {
35+
System.setProperty("webdriver.chrome.driver", new File(".").getCanonicalPath()+"/src/test/resources/selenium_browser_drivers/macChromedriver/chromedriver");
36+
} else if (workingOS.contains("linux")) {
37+
System.setProperty("webdriver.chrome.driver", new File(".").getCanonicalPath()+"/src/test/resources/selenium_browser_drivers/linuxChromedriver/chromedriver");
38+
}
39+
40+
}
41+
3242
@Bean
3343
public Proxy proxy() {
3444
Proxy proxy = null;
@@ -54,17 +64,6 @@ public BrowserDriverExtended.ChromeDriverExtended chrome() {
5464
return new BrowserDriverExtended.ChromeDriverExtended(BrowserCapabilities.newInstance().getChromeCapabilities());
5565
}
5666

57-
@PostConstruct
58-
public void systemPath() throws IOException {
59-
if (workingOS.contains("windows")) {
60-
System.setProperty("webdriver.chrome.driver", new File(".").getCanonicalPath()+"/src/test/resources/selenium_browser_drivers/windowsChromedriver/chromedriver.exe");
61-
} else if (workingOS.contains("mac")) {
62-
System.setProperty("webdriver.chrome.driver", new File(".").getCanonicalPath()+"/src/test/resources/selenium_browser_drivers/macChromedriver/chromedriver");
63-
} else if (workingOS.contains("linux")) {
64-
System.setProperty("webdriver.chrome.driver", new File(".").getCanonicalPath()+"/src/test/resources/selenium_browser_drivers/linuxChromedriver/chromedriver");
65-
}
66-
67-
}
6867

6968
public static class FirefoxCondition implements Condition {
7069
@Override

0 commit comments

Comments
 (0)