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