-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDriverFactory.java
More file actions
31 lines (24 loc) · 1.05 KB
/
DriverFactory.java
File metadata and controls
31 lines (24 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package com.clarkewerton.driver;
import com.clarkewerton.driver.manager.AndroidDriverManager;
import com.clarkewerton.driver.manager.IOSDriverManager;
import com.clarkewerton.exception.PlatformNotSupportedException;
import io.appium.java_client.AppiumDriver;
import org.openqa.selenium.WebElement;
public class DriverFactory {
public AppiumDriver createInstance(String platform, String udid, String platformVersion, String env) {
AppiumDriver driver;
Platform mobilePlatform = Platform.valueOf(platform.toUpperCase());
switch (mobilePlatform) {
case IOS:
driver = new IOSDriverManager().createInstance(udid, platformVersion, env);
break;
case ANDROID:
driver = new AndroidDriverManager().createInstance(udid, platformVersion, env);
break;
default:
throw new PlatformNotSupportedException(
"Platform not supported! Check if you set ios or android on the parameter.");
}
return driver;
}
}