Best Testsigma code snippet using com.testsigma.automator.drivers.WebDriverCapability.WebDriverCapability
Source:WebDriver.java
1package com.testsigma.automator.drivers.web;2import com.testsigma.automator.constants.TSCapabilityType;3import com.testsigma.automator.drivers.TestsigmaDriver;4import com.testsigma.automator.drivers.WebDriverCapability;5import com.testsigma.automator.entity.ExecutionLabType;6import com.testsigma.automator.exceptions.AutomatorException;7import com.testsigma.automator.utilities.TimeUtil;8import lombok.Data;9import lombok.EqualsAndHashCode;10import lombok.extern.log4j.Log4j2;11import org.openqa.selenium.html5.Location;12import org.openqa.selenium.html5.LocationContext;13import org.openqa.selenium.remote.Augmenter;14import org.openqa.selenium.remote.DesiredCapabilities;15import org.openqa.selenium.remote.LocalFileDetector;16import org.openqa.selenium.remote.RemoteWebDriver;17import java.net.MalformedURLException;18import java.time.Instant;19import java.util.Iterator;20import java.util.List;21@EqualsAndHashCode(callSuper = true)22@Data23@Log4j224public class WebDriver extends TestsigmaDriver {25 private static final String INVALID_GEO_LOCATION_ERROR = "Invalid \"geolocation\" desired capability value provided " +26 "in the execution configuration. For correct format refer to " +27 "https://testsigma.freshdesk.com/solution/articles/32000024808-sample-desired-capabilities";28 protected WebDriverCapability locationCapability;29 public WebDriver() {30 super();31 }32 @Override33 protected void setCapabilities() throws AutomatorException, MalformedURLException {34 super.setCapabilities();35 List<WebDriverCapability> additionalCapabilitiesList = webDriverSettings.getWebDriverCapabilities();36 setCommonCapabilities();37 setPlatformSpecificCapabilities();38 checkForLocationCapability(additionalCapabilitiesList);39 setBrowserSpecificCapabilities(additionalCapabilitiesList);40 setAdditionalCapabilities(additionalCapabilitiesList);41 }42 @Override43 protected void setCommonCapabilities() throws AutomatorException {44 super.setCommonCapabilities();45 capabilities.add(new WebDriverCapability(TSCapabilityType.NAME, executionName));46 capabilities.add(new WebDriverCapability(TSCapabilityType.ACCEPT_SSL_CERTS, Boolean.TRUE));47 capabilities.add(new WebDriverCapability(TSCapabilityType.UNHANDLED_PROMPT_BEHAVIOUR_KEY, TSCapabilityType.UNHANDLED_PROMPT_BEHAVIOUR_VALUE));48 }49 @Override50 protected void setTestsigmaLabCapabilities() throws AutomatorException {51 super.setTestsigmaLabCapabilities();52 }53 @Override54 protected void setHybridCapabilities() throws AutomatorException, MalformedURLException {55 super.setHybridCapabilities();56 }57 protected void setBrowserSpecificCapabilities(List<WebDriverCapability> additionalCapabilitiesList)58 throws AutomatorException {59 }60 protected void checkForLocationCapability(List<WebDriverCapability> additionalCapabilitiesList) {61 if (additionalCapabilitiesList != null) {62 for (Iterator<WebDriverCapability> single = additionalCapabilitiesList.listIterator(); single.hasNext(); ) {63 WebDriverCapability capability = single.next();64 String name = capability.getCapabilityName();65 if (com.testsigma.automator.constants.DesiredCapabilities.GEOLOCATION.equals(name)) {66 single.remove();67 locationCapability = new WebDriverCapability(name, capability.getCapabilityValue());68 }69 }70 }71 }72 @Override73 protected RemoteWebDriver createDriver(DesiredCapabilities desiredCapabilities) throws AutomatorException {74 Instant start = Instant.now();75 createDriverInstance(desiredCapabilities);76 Instant end = Instant.now();77 log.info("Web Driver Session Created in - " + TimeUtil.getFormattedDuration(start, end));78 log.info("Stating with post web driver creation actions");79 setLocation();80 setFileDetector();81 //deleteAllCookies();...
Source:FirefoxDriver.java
1package com.testsigma.automator.drivers.web;2import com.testsigma.automator.constants.EnvSettingsConstants;3import com.testsigma.automator.constants.TSCapabilityType;4import com.testsigma.automator.drivers.WebDriverCapability;5import com.testsigma.automator.exceptions.AutomatorException;6import com.testsigma.automator.utilities.PathUtil;7import lombok.Data;8import lombok.EqualsAndHashCode;9import lombok.extern.log4j.Log4j2;10import org.openqa.selenium.MutableCapabilities;11import org.openqa.selenium.firefox.FirefoxOptions;12import org.openqa.selenium.firefox.FirefoxProfile;13import org.openqa.selenium.remote.BrowserType;14import org.openqa.selenium.remote.CapabilityType;15import org.openqa.selenium.remote.DesiredCapabilities;16import org.openqa.selenium.remote.RemoteWebDriver;17import java.net.MalformedURLException;18import java.util.Iterator;19import java.util.List;20import java.util.Map;21@EqualsAndHashCode(callSuper = true)22@Data23@Log4j224public class FirefoxDriver extends WebDriver {25 FirefoxOptions firefoxOptions;26 public FirefoxDriver() {27 super();28 firefoxOptions = new FirefoxOptions();29 }30 @Override31 protected void createDriverInstance(DesiredCapabilities desiredCapabilities) throws AutomatorException {32 if (remoteServerURL != null) {33 remoteWebDriver = new RemoteWebDriver(remoteServerURL, firefoxOptions.merge(desiredCapabilities));34 } else {35 remoteWebDriver = new org.openqa.selenium.firefox.FirefoxDriver(new FirefoxOptions().merge(desiredCapabilities));36 }37 }38 @Override39 public void setTestsigmaLabCapabilities() throws AutomatorException {40 if (!"Linux".equals(getPlatform())) {41 MutableCapabilities mutableCapabilities = new MutableCapabilities();42 mutableCapabilities.setCapability(TSCapabilityType.SELENIUM_VERSION, "3.8.1");43 mutableCapabilities.setCapability(TSCapabilityType.NAME, executionName);44 mutableCapabilities.setCapability(EnvSettingsConstants.KEY_MAX_IDLE_TIME, EnvSettingsConstants.MAX_IDLE_TIME);45 mutableCapabilities.setCapability(EnvSettingsConstants.KEY_MAX_DURATION, EnvSettingsConstants.MAX_DURATION);46 mutableCapabilities.setCapability("username", this.getTestDeviceEntity().getUsername());47 mutableCapabilities.setCapability("accessKey", this.getTestDeviceEntity().getAccessKey());48 capabilities.add(new WebDriverCapability(TSCapabilityType.TESTSIGMA_LAB_OPTIONS, mutableCapabilities));49 setTestsigmaLabRemoteServerUrl();50 } else {51 super.setTestsigmaLabCapabilities();52 }53 capabilities.add(new WebDriverCapability(CapabilityType.BROWSER_NAME, BrowserType.FIREFOX));54 }55 protected void setAdditionalCapabilities(List<WebDriverCapability> additionalCapabilitiesList) {56 if (additionalCapabilitiesList != null) {57 for (WebDriverCapability capability : additionalCapabilitiesList) {58 String name = capability.getCapabilityName();59 capabilities.add(new WebDriverCapability(name, capability.getCapabilityValue()));60 }61 }62 }63 @Override64 public void setHybridCapabilities() throws AutomatorException, MalformedURLException {65 super.setHybridCapabilities();66 System.setProperty(TSCapabilityType.BROWSER_DRIVER_PROPERTY_FIREFOX,67 PathUtil.getInstance().getDriversPath() + settings.getHybridBrowserDriverPath());68 }69 @Override70 protected void setBrowserSpecificCapabilities(List<WebDriverCapability> additionalCapabilitiesList) throws AutomatorException {71 if (additionalCapabilitiesList != null) {72 for (Iterator<WebDriverCapability> single = additionalCapabilitiesList.listIterator(); single.hasNext(); ) {73 WebDriverCapability singleCap = single.next();74 String name = singleCap.getCapabilityName();75 if (com.testsigma.automator.constants.DesiredCapabilities.FIREFOXPROFILE.equals(name)) {76 FirefoxProfile profile = new FirefoxProfile();77 String values = singleCap.getCapabilityValue().toString();78 Map<String, Object> profiles = parseCapabilities(values, TSCapabilityType.FIREFOX_PROFILE);79 for (Map.Entry<String, Object> pro : profiles.entrySet()) {80 if (pro.getValue() instanceof Boolean) {81 profile.setPreference(pro.getKey(), (Boolean) pro.getValue());82 } else if (pro.getValue() instanceof Integer) {83 profile.setPreference(pro.getKey(), (Integer) pro.getValue());84 } else {85 profile.setPreference(pro.getKey(), (String) pro.getValue());86 }87 }88 capabilities.add(new WebDriverCapability(org.openqa.selenium.firefox.FirefoxDriver.PROFILE, profile));89 single.remove();90 }91 }92 }93 }94 @Override95 protected void setTimeouts() throws AutomatorException {96 if ("Linux".equals(getPlatform())) {97 super.setTimeouts();98 }99 }100}...
Source:AndroidWebDriver.java
1package com.testsigma.automator.drivers.mobile;2import com.testsigma.automator.constants.TSCapabilityType;3import com.testsigma.automator.drivers.WebDriverCapability;4import com.testsigma.automator.exceptions.AutomatorException;5import io.appium.java_client.remote.AndroidMobileCapabilityType;6import lombok.Data;7import lombok.EqualsAndHashCode;8import lombok.extern.log4j.Log4j2;9import org.openqa.selenium.chrome.ChromeOptions;10import org.openqa.selenium.remote.DesiredCapabilities;11import java.net.MalformedURLException;12@EqualsAndHashCode(callSuper = true)13@Data14@Log4j215public class AndroidWebDriver extends MobileWebDriver {16 public AndroidWebDriver() {17 super();18 }19 @Override20 protected void setHybridCapabilities() throws AutomatorException, MalformedURLException {21 super.setHybridCapabilities();22 ChromeOptions options = new ChromeOptions();23 options.setExperimentalOption("w3c", false);24 capabilities.add(new WebDriverCapability("nativeWebScreenshot", Boolean.TRUE));25 if (settings.getChromedriverExecutableDir() != null) {26 capabilities.add(new WebDriverCapability(TSCapabilityType.CHROME_DRIVER_EXECUTABLE_DIR,27 settings.getChromedriverExecutableDir()));28 }29 capabilities.add(new WebDriverCapability(ChromeOptions.CAPABILITY, options));30 capabilities.add(new WebDriverCapability(AndroidMobileCapabilityType.UNICODE_KEYBOARD, Boolean.TRUE));31 capabilities.add(new WebDriverCapability(AndroidMobileCapabilityType.RESET_KEYBOARD, Boolean.TRUE));32 }33 @Override34 protected void createDriverInstance(DesiredCapabilities desiredCapabilities) throws AutomatorException {35 remoteWebDriver = new io.appium.java_client.android.AndroidDriver<>(remoteServerURL, desiredCapabilities);36 }37}
WebDriverCapability
Using AI Code Generation
1import com.testsigma.automator.drivers.WebDriverCapability;2import org.openqa.selenium.WebDriver;3import org.openqa.selenium.chrome.ChromeDriver;4import org.openqa.selenium.chrome.ChromeOptions;5import org.openqa.selenium.remote.DesiredCapabilities;6import org.openqa.selenium.remote.RemoteWebDriver;7import java.net.MalformedURLException;8import java.net.URL;9import java.util.HashMap;10import java.util.Map;11import java.util.concurrent.TimeUnit;12public class WebDriverCapabilityTest {13 public static void main(String[] args) throws MalformedURLException {14 DesiredCapabilities capabilities = WebDriverCapability.getCapabilities("chrome");15 driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);16 driver.manage().window().maximize();17 driver.quit();18 }19}20import com.testsigma.automator.drivers.WebDriverCapability;21import org.openqa.selenium.WebDriver;22import org.openqa.selenium.chrome.ChromeDriver;23import org.openqa.selenium.chrome.ChromeOptions;24import org.openqa.selenium.remote.DesiredCapabilities;25import org.openqa.selenium.remote.RemoteWebDriver;26import java.net.MalformedURLException;27import java.net.URL;28import java.util.HashMap;29import java.util.Map;30import java.util.concurrent.TimeUnit;31public class WebDriverCapabilityTest {32 public static void main(String[] args) throws MalformedURLException {33 DesiredCapabilities capabilities = WebDriverCapability.getCapabilities("firefox");34 driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);35 driver.manage().window().maximize();36 driver.quit();37 }38}39import com.testsigma.automator.drivers.WebDriverCapability;40import org.openqa.selenium.WebDriver;41import org.openqa.selenium.chrome.ChromeDriver;42import org.openqa.selenium.chrome.ChromeOptions;43import org.openqa.selenium.remote.DesiredCapabilities;44import org.openqa.selenium.remote.RemoteWebDriver;45import java.net.MalformedURLException;46import java.net.URL;47import java.util.HashMap;48import java.util.Map;49import java.util.concurrent.TimeUnit;50public class WebDriverCapabilityTest {51 public static void main(String[] args)
WebDriverCapability
Using AI Code Generation
1import com.testsigma.automator.drivers.WebDriverCapability;2import org.openqa.selenium.WebDriver;3import org.openqa.selenium.chrome.ChromeDriver;4import org.openqa.selenium.remote.DesiredCapabilities;5import org.openqa.selenium.remote.RemoteWebDriver;6import java.net.URL;7public class WebDriverCapabilityExample {8public static void main(String[] args) throws Exception {9DesiredCapabilities capabilities = WebDriverCapability.getCapabilities("chrome");10System.out.println("Title of the page is: " + driver.getTitle());11driver.quit();12}13}14import com.testsigma.automator.drivers.WebDriverCapability;15import org.openqa.selenium.WebDriver;16import org.openqa.selenium.chrome.ChromeDriver;17import org.openqa.selenium.remote.DesiredCapabilities;18import org.openqa.selenium.remote.RemoteWebDriver;19import java.net.URL;20public class WebDriverCapabilityExample {21public static void main(String[] args) throws Exception {22DesiredCapabilities capabilities = WebDriverCapability.getCapabilities("firefox");23System.out.println("Title of the page is: " + driver.getTitle());24driver.quit();25}26}27import com.testsigma.automator.drivers.WebDriverCapability;28import org.openqa.selenium.WebDriver;29import org.openqa.selenium.chrome.ChromeDriver;30import org.openqa.selenium.remote.DesiredCapabilities;31import org.openqa.selenium.remote.RemoteWebDriver;32import java.net.URL;33public class WebDriverCapabilityExample {34public static void main(String[] args) throws Exception {35DesiredCapabilities capabilities = WebDriverCapability.getCapabilities("ie");
WebDriverCapability
Using AI Code Generation
1import com.testsigma.automator.drivers.WebDriverCapability;2import org.openqa.selenium.WebDriver;3import org.openqa.selenium.chrome.ChromeDriver;4import org.openqa.selenium.chrome.ChromeOptions;5import org.openqa.selenium.remote.DesiredCapabilities;6public class TestClass {7 public static void main(String[] args) {8 DesiredCapabilities capabilities = new DesiredCapabilities();9 capabilities = WebDriverCapability.setProxy("localhost", 8080, "http");10 capabilities = WebDriverCapability.setProxy("localhost", 8080, "https");11 capabilities = WebDriverCapability.setProxy("localhost", 8080, "ftp");12 capabilities = WebDriverCapability.setProxy("localhost", 8080, "socks");13 capabilities = WebDriverCapability.setProxy("localhost", 8080, "socks4");14 capabilities = WebDriverCapability.setProxy("localhost", 8080, "socks5");15 capabilities = WebDriverCapability.setProxy("localhost", 8080, "all");16 capabilities = WebDriverCapability.setProxy("localhost", 8080, "none");17 capabilities = WebDriverCapability.setProxy("localhost", 8080, "foo");18 capabilities = WebDriverCapability.setProxy("localhost", 8080, null);19 capabilities = WebDriverCapability.setProxy(null, 8080, "http");20 capabilities = WebDriverCapability.setProxy(null, 8080, "https");21 capabilities = WebDriverCapability.setProxy(null, 8080, "ftp");22 capabilities = WebDriverCapability.setProxy(null, 8080, "socks");23 capabilities = WebDriverCapability.setProxy(null, 8080, "socks4");24 capabilities = WebDriverCapability.setProxy(null, 8080, "socks5");25 capabilities = WebDriverCapability.setProxy(null, 8080, "all");26 capabilities = WebDriverCapability.setProxy(null, 8080, "none");27 capabilities = WebDriverCapability.setProxy(null, 8080, "foo");28 capabilities = WebDriverCapability.setProxy(null, 8080, null);29 capabilities = WebDriverCapability.setProxy("localhost", 0, "http");30 capabilities = WebDriverCapability.setProxy("localhost", 0, "https");31 capabilities = WebDriverCapability.setProxy("localhost", 0, "ftp");32 capabilities = WebDriverCapability.setProxy("localhost", 0, "socks");33 capabilities = WebDriverCapability.setProxy("localhost", 0, "socks4");34 capabilities = WebDriverCapability.setProxy("localhost",
WebDriverCapability
Using AI Code Generation
1import com.testsigma.automator.drivers.WebDriverCapability;2import org.openqa.selenium.remote.DesiredCapabilities;3import org.openqa.selenium.remote.RemoteWebDriver;4import java.net.URL;5public class 2 {6 public static void main(String[] args) throws Exception {7 DesiredCapabilities capabilities = WebDriverCapability.getCapabilities("chrome", "latest");8 System.out.println(driver.getTitle());9 driver.quit();10 }11}12import com.testsigma.automator.drivers.WebDriverCapability;13import org.openqa.selenium.remote.DesiredCapabilities;14import org.openqa.selenium.remote.RemoteWebDriver;15import java.net.URL;16public class 3 {17 public static void main(String[] args) throws Exception {18 DesiredCapabilities capabilities = WebDriverCapability.getCapabilities("firefox", "latest");19 System.out.println(driver.getTitle());20 driver.quit();21 }22}23import com.testsigma.automator.drivers.WebDriverCapability;24import org.openqa.selenium.remote.DesiredCapabilities;25import org.openqa.selenium.remote.RemoteWebDriver;26import java.net.URL;27public class 4 {28 public static void main(String[] args) throws Exception {29 DesiredCapabilities capabilities = WebDriverCapability.getCapabilities("ie", "latest");30 System.out.println(driver.getTitle());31 driver.quit();32 }33}34import com.testsigma.automator.drivers.WebDriverCapability;35import org.openqa.selenium.remote.DesiredCapabilities;36import org.openqa.selenium.remote.RemoteWebDriver;37import java.net.URL;38public class 5 {39 public static void main(String[] args) throws Exception {40 DesiredCapabilities capabilities = WebDriverCapability.getCapabilities("opera", "latest");
WebDriverCapability
Using AI Code Generation
1package com.testsigma.automator.drivers;2import org.openqa.selenium.remote.DesiredCapabilities;3public class WebDriverCapability {4public static DesiredCapabilities getDesiredCapabilities(String browserName, String browserVersion, String os, String osVersion, String deviceName) {5DesiredCapabilities capabilities = new DesiredCapabilities();6capabilities.setCapability("browserName", browserName);7capabilities.setCapability("browserVersion", browserVersion);8capabilities.setCapability("os", os);9capabilities.setCapability("osVersion", osVersion);10capabilities.setCapability("deviceName", deviceName);11return capabilities;12}13}14package com.testsigma.automator.drivers;15import org.openqa.selenium.remote.DesiredCapabilities;16public class WebDriverCapability {17public static DesiredCapabilities getDesiredCapabilities(String browserName, String browserVersion, String os, String osVersion, String deviceName) {18DesiredCapabilities capabilities = new DesiredCapabilities();19capabilities.setCapability("browserName", browserName);20capabilities.setCapability("browserVersion", browserVersion);21capabilities.setCapability("os", os);22capabilities.setCapability("osVersion", osVersion);23capabilities.setCapability("deviceName", deviceName);24return capabilities;25}26}27package com.testsigma.automator.drivers;28import org.openqa.selenium.remote.DesiredCapabilities;29public class WebDriverCapability {30public static DesiredCapabilities getDesiredCapabilities(String browserName, String browserVersion, String os, String osVersion, String deviceName) {31DesiredCapabilities capabilities = new DesiredCapabilities();32capabilities.setCapability("browserName", browserName);33capabilities.setCapability("browserVersion", browserVersion);34capabilities.setCapability("os", os);35capabilities.setCapability("osVersion", osVersion);36capabilities.setCapability("deviceName", deviceName);37return capabilities;38}39}40package com.testsigma.automator.drivers;41import org.openqa.selenium.remote.DesiredCapabilities;42public class WebDriverCapability {43public static DesiredCapabilities getDesiredCapabilities(String browserName, String browserVersion, String os, String osVersion, String deviceName) {44DesiredCapabilities capabilities = new DesiredCapabilities();45capabilities.setCapability("browserName", browserName);46capabilities.setCapability("
WebDriverCapability
Using AI Code Generation
1com.testsigma.automator.drivers.WebDriverCapability driverCapability = new com.testsigma.automator.drivers.WebDriverCapability();2driverCapability.setCapability("browserName", "chrome");3driverCapability.setCapability("version", "72");4driverCapability.setCapability("platform", "Windows 10");5driverCapability.setCapability("resolution", "1024x768");6driverCapability.setCapability("headless", "true");7driverCapability.setCapability("video", "true");8driverCapability.setCapability("network", "true");9driverCapability.setCapability("console", "true");10driverCapability.setCapability("seleniumVersion", "3.141.59");11driverCapability.setCapability("name", "testname");12driverCapability.setCapability("build", "testbuild");13driverCapability.setCapability("tags", "tag1,tag2");14driverCapability.setCapability("customData", "testcustomdata");15driverCapability.setCapability("browserstack.local", "true");16driverCapability.setCapability("browserstack.localIdentifier", "testidentifier");17driverCapability.setCapability("browserstack.seleniumLogs", "true");18driverCapability.setCapability("browserstack.debug", "true");19driverCapability.setCapability("browserstack.networkLogs", "true");20driverCapability.setCapability("browserstack.console", "true");21driverCapability.setCapability("browserstack.appiumLogs", "true");22driverCapability.setCapability("browserstack.ie.noFlash", "true");23driverCapability.setCapability("browserstack.ie.enablePopups", "true");24driverCapability.setCapability("browserstack.ie.enablePersistentHover", "true");25driverCapability.setCapability("browserstack.ie.usePerProcessProxy", "true");26driverCapability.setCapability("browserstack.ie.ensureCleanSession", "true");27driverCapability.setCapability("browserstack.ie.driver", "testdriver");28driverCapability.setCapability("browserstack.ie.driverVersion", "testdriverversion");29driverCapability.setCapability("browserstack.ie.driverArchitecture", "testdriverarchitecture");30driverCapability.setCapability("browserstack.ie.driverLogs", "testdriverlogs");31driverCapability.setCapability("browserstack.ie.driverLogsVerbose", "true");32driverCapability.setCapability("browserstack.ie.driverArgs", "testdriverargs");33driverCapability.setCapability("browserstack.ie.driverForceKill", "true");34driverCapability.setCapability("browserstack.ie.driverForceKillTimeout", "testforcetimeout");
WebDriverCapability
Using AI Code Generation
1package com.testsigma.automator.sample;2import org.openqa.selenium.WebDriver;3import org.openqa.selenium.chrome.ChromeDriver;4import org.openqa.selenium.firefox.FirefoxDriver;5import org.openqa.selenium.ie.InternetExplorerDriver;6import org.openqa.selenium.opera.OperaDriver;7import org.openqa.selenium.safari.SafariDriver;8import org.testng.annotations.AfterTest;9import org.testng.annotations.BeforeTest;10import org.testng.annotations.Test;11import com.testsigma.automator.drivers.WebDriverCapability;12public class WebDriverCapabilityTest {13 public WebDriver driver;14 public String browser;15 public void setup() {16 browser = "firefox";17 }18 public void test() throws Exception {19 if (browser.equalsIgnoreCase("chrome")) {20 System.setProperty("webdriver.chrome.driver", "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chromedriver.exe");21 driver = new ChromeDriver(WebDriverCapability.chromeCapabilities());22 } else if (browser.equalsIgnoreCase("firefox")) {23 System.setProperty("webdriver.gecko.driver", "C:\\Program Files (x86)\\Mozilla Firefox\\geckodriver.exe");24 driver = new FirefoxDriver(WebDriverCapability.firefoxCapabilities());25 } else if (browser.equalsIgnoreCase("ie")) {26 System.setProperty("webdriver.ie.driver", "C:\\Program Files (x86)\\Internet Explorer\\IEDriverServer.exe");27 driver = new InternetExplorerDriver(WebDriverCapability.ieCapabilities());28 } else if (browser.equalsIgnoreCase("safari")) {29 driver = new SafariDriver(WebDriverCapability.safariCapabilities());30 } else if (browser.equalsIgnoreCase("opera")) {31 System.setProperty("webdriver.opera.driver", "C:\\Program Files (x86)\\Opera Software\\Opera\\operadriver.exe");32 driver = new OperaDriver(WebDriverCapability.operaCapabilities());33 }34 }35 public void tearDown() {36 driver.quit();37 }38}
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!