Member-only story
C# Expected Conditions are Deprecated. So what?
My recent Selenium automation projects are built in C#.
It was a while since I did any coding in this language but, since C# was created from Java, I did not expect more than a few days of adjusting to the Selenium C# binding.
One of the surprises I had was the fact that the C# ExpectedConditions class is deprecated.
How was I supposed to do any synchronization between the site and the tests without it?
It turned out that synchronization was still achievable in just a few lines of code.
I am going to show you a quick Selenium solution without any synchronization so it is easy to understand where the synchronization comes into play.
The test class has 2 tests only, both about searching for a keyword:
using NUnit.Framework;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using System;
using System.Collections.ObjectModel;
using OpenQA.Selenium.Support.UI;namespace UnitTestPackage {
public class TestClass { private ChromeDriver driver; private readonly String homeUrl = “http://www.vpl.ca";
private readonly String resultsUrl = “vpl.bibliocommons.com”; private readonly String keyword =…