Skip to content

Commit

Permalink
[wdc] Modify WD provider
Browse files Browse the repository at this point in the history
  • Loading branch information
ngoanh2n committed Dec 25, 2022
1 parent 7babe07 commit ab11ca8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ public class AppiumDriverProvider {
private static final Logger LOGGER = LoggerFactory.getLogger(AppiumDriverProvider.class);
public static Prop<String> caps = new Prop<>("wdc.caps", String.class);

public static WebDriver createDriver() {
AppiumDriverLocalService localService = startAppiumServer();
Capabilities caps = readCaps();
return new AppiumDriver(localService, caps);
}

public static Capabilities readCaps() {
DesiredCapabilities caps = new DesiredCapabilities();
Map<String, Object> providedCaps = YamlData.toMapFromResource(AppiumDriverProvider.caps.getValue());
Expand Down Expand Up @@ -52,12 +58,6 @@ private static AppiumDriverLocalService startAppiumServer() {
return localService;
}

public static WebDriver createDriver() {
AppiumDriverLocalService localService = startAppiumServer();
Capabilities caps = readCaps();
return new AppiumDriver(localService, caps);
}

private final static class StopAppiumServerThread extends Thread {
private final AppiumDriverLocalService service;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
* @version 1.0.0
* @since 2022-08-20
*/
public class CloudDriverProvider extends AppiumDriverProvider {
public class CloudDriverProvider {
public static Prop<String> key = new Prop<>("wdc.key", String.class);
public static Prop<String> token = new Prop<>("wdc.token", String.class);
public static Prop<String> domain = new Prop<>("wdc.domain", String.class);

public static WebDriver createDriver() {
Capabilities caps = readCaps();
URL address = createRemoteAddress();
Capabilities caps = AppiumDriverProvider.readCaps();
return new RemoteWebDriver(address, caps);
}

Expand Down

0 comments on commit ab11ca8

Please sign in to comment.