List of usage examples for org.openqa.selenium.safari SafariDriver SafariDriver
public SafariDriver()
From source file:com.zaizi.automation.abfts.drivers.SafariDriverStore.java
License:Open Source License
/** * @return */ public SafariDriver createWebDriver() { driver = new SafariDriver(); return driver; }
From source file:cucumber.scratch.maven.react.SeleniumConfiguration.java
License:Apache License
@Bean(destroyMethod = "quit") public WebDriver driver(@Value("${web.driver:chrome}") String webDriver) { if ("chrome".equals(webDriver)) { return new ChromeDriver(); }/*w w w . j a va2 s . c o m*/ if ("firefox".equals(webDriver)) { return new FirefoxDriver(); } if ("ie".equals(webDriver)) { return new InternetExplorerDriver(); } if ("safari".equals(webDriver)) { return new SafariDriver(); } if ("opera".equals(webDriver)) { return new OperaDriver(); } throw new IllegalArgumentException(format("Web driver %s not supported.", webDriver)); }
From source file:de.learnlib.alex.learning.entities.webdrivers.SafariDriverConfig.java
License:Apache License
@Override public WebDriver createDriver() throws Exception { final WebDriver driver = new SafariDriver(); manage(driver);//w w w . j a v a 2s.c om return driver; }
From source file:gov.nih.nci.firebird.commons.selenium2.test.WebDriverModule.java
License:Open Source License
@Provides @Singleton/* ww w . ja v a2 s. com*/ @Named("selenium.safari.driver") public WebDriver provideSafariDriver() { final WebDriver driver = new SafariDriver(); closeDriverOnShutdown(driver); return driver; }
From source file:ibw.updater.selenium.SeleniumDriverFactory.java
License:Open Source License
public WebDriver driver() { if (CHROME_DRIVER.equalsIgnoreCase(driverName)) { return new ChromeDriver(); } else if (EDGE_DRIVER.equalsIgnoreCase(driverName)) { return new EdgeDriver(); } else if (IE_DRIVER.equalsIgnoreCase(driverName)) { return new EdgeDriver(); } else if (OPERA_DRIVER.equalsIgnoreCase(driverName)) { return new OperaDriver(); } else if (SAFARI_DRIVER.equalsIgnoreCase(driverName)) { return new SafariDriver(); }/* ww w.j av a 2 s . co m*/ return new FirefoxDriver(); }
From source file:io.fabric8.selenium.SeleniumTests.java
License:Apache License
protected static WebDriver doCreateWebDriver() { String driverName = Systems.getEnvVarOrSystemProperty(FABRIC8_WEBDRIVER_NAME); if (driverName != null) { driverName = driverName.toLowerCase(); if (driverName.equals("chrome")) { return new ChromeDriver(); } else if (driverName.equals("edge")) { return new EdgeDriver(); } else if (driverName.equals("firefox")) { return new FirefoxDriver(); } else if (driverName.equals("htmlunit")) { return new HtmlUnitDriver(); } else if (driverName.equals("internetexplorer") || driverName.equals("ie")) { return new InternetExplorerDriver(); } else if (driverName.equals("opera")) { return new OperaDriver(); } else if (driverName.equals("phantomjs")) { return new PhantomJSDriver(); /*//from w w w. j a va 2 s. c om } else if (driverName.equals("remote")) { return new RemoteWebDriver(); */ } else if (driverName.equals("safari")) { return new SafariDriver(); } else if (driverName.equals("htmlunit")) { return new HtmlUnitDriver(); } } return new ChromeDriver(); }
From source file:io.github.bonigarcia.wdm.test.SafariTest.java
License:Open Source License
@Before public void setup() { driver = new SafariDriver(); }
From source file:io.kahu.hawaii.cucumber.glue.html.HtmlSteps.java
License:Apache License
@Before("@web") public void beforeScenario() throws Exception { WebDriver driver;//from w w w. j a va 2 s.c o m if (StringUtils.containsIgnoreCase(browser, "chrome")) { if (remote) { DesiredCapabilities capabilities = DesiredCapabilities.chrome(); driver = createRemoteWebDriverForCapabilities(capabilities); } else { driver = new ChromeDriver(); } } else if (StringUtils.containsIgnoreCase(browser, "opera")) { if (remote) { DesiredCapabilities capabilities = DesiredCapabilities.operaBlink(); driver = createRemoteWebDriverForCapabilities(capabilities); } else { driver = new OperaDriver(); } } else if (StringUtils.containsIgnoreCase(browser, "firefox")) { if (remote) { DesiredCapabilities capabilities = DesiredCapabilities.firefox(); driver = createRemoteWebDriverForCapabilities(capabilities); } else { driver = new FirefoxDriver(); } } else if (StringUtils.containsIgnoreCase(browser, "htmlunit")) { driver = new HtmlUnitDriver(BrowserVersion.CHROME); } else if (StringUtils.containsIgnoreCase(browser, "iexplore")) { if (remote) { DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer(); driver = createRemoteWebDriverForCapabilities(capabilities); } else { driver = new InternetExplorerDriver(); } } else if (StringUtils.containsIgnoreCase(browser, "phantom")) { DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, getOsSpecificPhantomDriverPath()); Proxy proxy = getHttpProxy(); if (proxy != null) { capabilities.setCapability(CapabilityType.PROXY, getHttpProxy()); } driver = new PhantomJSDriver(capabilities); } else if (StringUtils.containsIgnoreCase(browser, "safari")) { if (remote) { DesiredCapabilities capabilities = DesiredCapabilities.safari(); driver = createRemoteWebDriverForCapabilities(capabilities); } else { driver = new SafariDriver(); } } else { throw new IllegalStateException("Unsupported browser specified"); } webDriver = new EventFiringWebDriver(driver); webDriver.manage().deleteAllCookies(); turnOnImplicitWaits(); }
From source file:it.pegaso2000.seleniumtester.cqatest.BaseTest.java
protected WebDriver getDriverByName(String drivername) { WebDriver drv = null;/* www . ja va 2 s .com*/ switch (drivername) { case "ff": drv = new FirefoxDriver(); break; case "ie": drv = new InternetExplorerDriver(); break; case "sf": drv = new SafariDriver(); break; case "ch": drv = new ChromeDriver(); break; default: //TODO: gestire errore driver non trovato break; } //TODO: congirare driver return drv; }
From source file:javax.portlet.tck.driver.TCKSimpleTestDriver.java
License:Apache License
/** * @throws java.lang.Exception//from w w w . j av a2 s. c o m */ @BeforeClass public static void setUpBeforeClass() throws Exception { loginUrl = System.getProperty("test.server.login.url"); host = System.getProperty("test.server.host"); port = System.getProperty("test.server.port"); username = System.getProperty("test.server.username"); usernameId = System.getProperty("test.server.username.id"); password = System.getProperty("test.server.password"); passwordId = System.getProperty("test.server.password.id"); browser = System.getProperty("test.browser"); testContextBase = System.getProperty("test.context.base"); String str = System.getProperty("test.url.strategy"); useGeneratedUrl = str.equalsIgnoreCase("generateURLs"); str = System.getProperty("test.debug"); debug = str.equalsIgnoreCase("true"); str = System.getProperty("test.timeout"); dryrun = new Boolean(System.getProperty("test.dryrun")); timeout = ((str != null) && str.matches("\\d+")) ? Integer.parseInt(str) : 3; String wd = System.getProperty("test.browser.webDriver"); String binary = System.getProperty("test.browser.binary"); boolean browserDefaultHeadless = browser.equalsIgnoreCase("chrome") || browser.equalsIgnoreCase("firefox") || browser.equalsIgnoreCase("htmlunit") || browser.equalsIgnoreCase("phantomjs"); String headlessProperty = System.getProperty("test.browser.headless"); boolean headless = (((headlessProperty == null) || (headlessProperty.length() == 0)) && browserDefaultHeadless); System.out.println("before class."); System.out.println(" Debug =" + debug); System.out.println(" Dryrun =" + dryrun); System.out.println(" Timeout =" + timeout); System.out.println(" Login URL =" + loginUrl); System.out.println(" Host =" + host); System.out.println(" Port =" + port); System.out.println(" Context =" + testContextBase); System.out.println(" Generate URL =" + useGeneratedUrl); System.out.println(" Username =" + username); System.out.println(" UsernameId =" + usernameId); System.out.println(" Password =" + password); System.out.println(" PasswordId =" + passwordId); System.out.println(" Browser =" + browser); System.out.println(" Driver =" + wd); System.out.println(" binary =" + binary); System.out.println(" headless =" + headless); if (browser.equalsIgnoreCase("firefox")) { System.setProperty("webdriver.gecko.driver", wd); FirefoxOptions options = new FirefoxOptions(); options.setLegacy(true); options.setAcceptInsecureCerts(true); if ((binary != null) && (binary.length() != 0)) { options.setBinary(binary); } if (headless) { options.setHeadless(true); } driver = new FirefoxDriver(options); } else if (browser.equalsIgnoreCase("internetExplorer")) { System.setProperty("webdriver.ie.driver", wd); driver = new InternetExplorerDriver(); } else if (browser.equalsIgnoreCase("chrome")) { System.setProperty("webdriver.chrome.driver", wd); ChromeOptions options = new ChromeOptions(); if ((binary != null) && (binary.length() > 0)) { options.setBinary(binary); } if (headless) { options.addArguments("--headless"); } options.addArguments("--disable-infobars"); options.setAcceptInsecureCerts(true); driver = new ChromeDriver(options); } else if (browser.equalsIgnoreCase("phantomjs")) { DesiredCapabilities capabilities = DesiredCapabilities.phantomjs(); capabilities.setJavascriptEnabled(true); capabilities.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, binary); driver = new PhantomJSDriver(capabilities); } else if (browser.equalsIgnoreCase("htmlUnit")) { driver = new HtmlUnitDriver(true); } else if (browser.equalsIgnoreCase("safari")) { driver = new SafariDriver(); } else { throw new Exception("Unsupported browser: " + browser); } if (!dryrun) { login(); } }