Using Selenium to Navigate to a URL

Below is a code sample instructing Selenium to navigate to a URL

// A basic Selenium file to open a web page in Firefox
package net.brav3.webdriver.A1;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class NavigateToAUrl {
	public static void main(String[] args) {
		WebDriver driver = new FirefoxDriver();

We create a WebDriver object for Firefox. Then we use the driver to instruct Firefox to load the URL via the get method.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.