How can I perform Selenium automation testing of my website online?

Can anyone please guide me on how can I perform Selenium automation testing of my website online.

Hi @michael-webb,

Begin with Selenium

First, you must evaluate the application that you wish to automate. Next, decide if you want to use record and play or create powerful, browser-based regression automation test suites.

If you don’t require a comprehensive framework and the tests you wish to automate are basic, you can use Selenium IDE’s record and play functionality. You can implement it as a Chrome and Firefox extension. It has intelligent field selection that can identify an element based on ID, Class, and Xpath.

Creating a WebDriver Instance:

You need to develop a Webdriver instance. You can relate to WebDriver and have child objects of its implementation classes such as GoogleChrome, Internet Explorer, and several others.

WebDriver driver= new FirefoxDriver();

WebDriver driver = new ChromeDriver();

WebDriver driver = new InternetExplorerDriver();

Also, please note that if you’re using ChromeDriver or InternetExplorerDriver, you’ll need to use System.setproperty to set the path to their executable file.

System.setProperty(“webdriver.chrome.driver”, “Path”)

System.setproperty(“http://webdriver.ie.driver”,“Path”);

You do not need to specify it for Firefox, but if your selenium version is higher than 3.0, you must set the path of the gecko driver in your script.

System.setProperty(“webdriver.gecko.driver”,“Path”);

Visit the Webpage You Want To Test: Now that you’ve created an instance of webdriver, it’s time to open the web application you want to test. The get or navigate.to.URL() functions can be used to navigate to webdriver.

/ driver.get(“URL”); This will take you to the webpage you wish to test.

Locating an HTML Element on a Webpage

Now that you’ve landed at the webpage, you can interact with it using HTML components. There are numerous locators available to help you locate the elements. They are as follows: name, class name, Xpath, CSS, and ID. You can use firebug or development tools to locate your target element.

WebElement login = driver.findElement(Domain Premium: By.id(“”)); / a locator example

Estimate the Browser’s Response to the Activity:

The browser will take some time to load the page. You should set a default time for all web elements to wait until the driver instance expires. This is possible with Selenium’s implicit wait.

driver.manage().

timeouts().

Wait(10,TimeUnit.SECONDS) implicitly;

This time would apply to all web elements. However, there are situations when only one element takes time to load; in such cases, you should use explicit wait.

wait WebDriverWait=new WebDriverWait(driver, 20);

until(ExpectedConditions.visibilityOfElementLocated(By.xpath(“”)));

You can have N conditions with the wait object.

End Browser Session

After the required test is completed, you can close the browser.

driver.close(); / This function will terminate the current session.

Using a Test Framework, run tests and record results.

Everything I’ve mentioned till this point will help you execute a single test. You can even keep a framework in place to run test suites and generate appealing reports. To create such a strong foundation, you can use Maven, POM, and TestNG.

1 Like