Member-only story

How to check if the page is reloaded in a Selenium test

Alex Siminiuc
3 min readMar 7, 2020

--

(Selenium for Beginners)

Photo by Kai Pilger on Unsplash

Let’s say that you automated the following test case for the Vancouver Public Library site:

  • Open home page
  • Search for Java
  • Check that results page is displayed
  • Check that the total results count is positive
  • Select the book filter on the left side
  • Check that the new total results count is lower than the initial one

The code for the automated test is below (in C#):

using NUnit.Framework;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium.Remote;
using OpenQA.Selenium.Support.UI;
using System;
using System.IO;
using System.Threading;
namespace NUnitTestProject1
{
public class Tests2
{
private IWebDriver driver;
private WebDriverWait wait;
private By searchBoxId = By.Id(“edit-search”); private By searchButtonId = By.Id(“edit-submit”); private By countXpath =
By.XPath(“//span[@data-key = ‘pagination-text’]”);
private By bookFilterXpath =…

--

--

Alex Siminiuc
Alex Siminiuc

No responses yet