In this post , we share a working example of Selenium Web automation tool java code to invoke a website on selenium grid using firefox browser.
This piece of code was executed successfully on Eclipse IDE integrated with Selenium WebDriver 3.4.0 . Hope it may be useful to few beginners.
package automationFramework;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.Augmenter;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
public class gridtest {
public static void main(String[] args) throws InterruptedException, MalformedURLException {
WebDriver driver = new RemoteWebDriver(
new URL("http://172.20.3.125:4444/wd/hub"),
DesiredCapabilities.firefox());
driver.get("http://www.google.com");
}
}
This piece of code was executed successfully on Eclipse IDE integrated with Selenium WebDriver 3.4.0 . Hope it may be useful to few beginners.
package automationFramework;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.Augmenter;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
public class gridtest {
public static void main(String[] args) throws InterruptedException, MalformedURLException {
WebDriver driver = new RemoteWebDriver(
new URL("http://172.20.3.125:4444/wd/hub"),
DesiredCapabilities.firefox());
driver.get("http://www.google.com");
}
}