Added code
This commit is contained in:
@@ -30,6 +30,14 @@ brew install maven
|
||||
|
||||
4. Quit the driver
|
||||
|
||||
## Start Selenium Stand Alone
|
||||
|
||||
Just type the command:
|
||||
|
||||
```
|
||||
java -Dwebdriver.chrome.driver=chromedriver -Dwebdriver.gecko.driver=geckodriver -jar selenium-server-standalone-3.141.59.jar
|
||||
```
|
||||
|
||||
## Support
|
||||
|
||||
This tutorial is released into the public domain by ITNove under WTFPL.
|
||||
|
||||
2
pom.xml
2
pom.xml
@@ -4,7 +4,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.itnove.trainings.webdriver</groupId>
|
||||
<artifactId>StartUsingWebDriver</artifactId>
|
||||
<version>19.02.19</version>
|
||||
<version>19.06.14</version>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
|
||||
@@ -2,8 +2,6 @@ package com.itnove.trainings.testng.startUsingWebDriver;
|
||||
|
||||
|
||||
import org.openqa.selenium.JavascriptExecutor;
|
||||
import org.openqa.selenium.chrome.ChromeDriver;
|
||||
import org.openqa.selenium.firefox.FirefoxDriver;
|
||||
import org.openqa.selenium.interactions.Actions;
|
||||
import org.openqa.selenium.remote.DesiredCapabilities;
|
||||
import org.openqa.selenium.remote.RemoteWebDriver;
|
||||
@@ -11,7 +9,7 @@ import org.testng.annotations.AfterMethod;
|
||||
import org.testng.annotations.BeforeMethod;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@@ -27,22 +25,23 @@ public class BaseTest {
|
||||
public static JavascriptExecutor jse;
|
||||
|
||||
@BeforeMethod
|
||||
public void setUp() throws IOException {
|
||||
public void setUp() throws MalformedURLException {
|
||||
String browser = System.getProperty("browser");
|
||||
DesiredCapabilities capabilities;
|
||||
if (browser != null && browser.equalsIgnoreCase("chrome")) {
|
||||
capabilities = DesiredCapabilities.chrome();
|
||||
System.setProperty("webdriver.chrome.driver", "src" + File.separator + "main" + File.separator + "resources" + File.separator + "chromedriver-macos");
|
||||
driver = new ChromeDriver(capabilities);
|
||||
//driver = new ChromeDriver(capabilities);
|
||||
} else {
|
||||
capabilities = DesiredCapabilities.firefox();
|
||||
System.setProperty("webdriver.gecko.driver",
|
||||
"src" + File.separator + "main"
|
||||
+ File.separator + "resources"
|
||||
+ File.separator + "geckodriver-macos");
|
||||
driver = new FirefoxDriver(capabilities);
|
||||
//driver = new FirefoxDriver(capabilities);
|
||||
}
|
||||
//driver = new RemoteWebDriver(new URL("http://0.0.0.0:4444/wd/hub"), capabilities);
|
||||
driver = new RemoteWebDriver(new URL("http://0.0.0.0:4444/wd/hub"), capabilities);
|
||||
wait = new LocalRemoteWebDriverWait(driver, timeOut);
|
||||
hover = new Actions(driver);
|
||||
driver.manage().deleteAllCookies();
|
||||
@@ -55,5 +54,4 @@ public class BaseTest {
|
||||
public void tearDown() {
|
||||
driver.quit();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user