Selenium 3.11 Released
So, Selenium 3.11 was released. What exactly does this mean for you?
Below, I will help you to understand the new features and one huge challenge that has now been added with this release.
Say Goodbye to PageObjectFactory
If you look at the release notes for Selenium .NET release of 3.11, the PageObjectFactory is now gone.
Honestly, I’m grateful… that thing sucked.
I’ve tried to use it long ago and it worked really poorly. This is certainly a plus.
This change reduces complexity in the Selenium code base and will stop people from posting examples online using the PageObjectFactory.
Say Goodbye to ExpectedConditions.cs
If you’ve grown to love the WebDriverWait and ExpectedConditions class as I have, this comes as a blow.
When I first saw this, I did a double take… Huh? What?
So why did the .NET implementation of ExpectedConditions move to a separate code base?
According to my conversation with Jim Evans, here is why:
Yes, it reduces the size of the code base, as well as the maintenance burden. It reduces the number of times the maintainer has to respond to issues and PRs for that class. This is the proper path forward for the community to be able to enhance and maintain these methods, as the class provided by the Selenium project was frozen long ago, with PRs adding new methods being rejected.
I’ve never contributed any code to Selenium and have never had to maintain it. But I do know that software maintenance can suck…
So we do all that we can to reduce it. However, in this case, it seems to be a mistake.
I personally use the ExpectedConditions.cs on a regular basis. And I find it very useful.
Here’s the deal:
As a user of the software, my life should be easy. Instead, I now have to write my own lambda expressions to figure out if an element is in a valid state on a page.
Ugh! Definitely extra work for me. Especially when I mess up the logic 🙁
Again, I don’t support the project and don’t understand their point of view. But it seems silly to remove maintenance work from the project by decreasing usability for the end user.
But what do I know? When I create a software like Selenium, maybe then I should be allowed to complain 🙂
Instead, I’ll stop whining and tell you how you can fix these problems…
So what can you do?
First, prepare yourself for the loss of PageObjectFactory. If you are taking my Complete Selenium WebDriver with C# course, you don’t have to worry about this 🙂
Second, prepare yourself for the broken code that will occur on a future Selenium version (>3.11) when the Selenium project removes ExpectedConditions.cs.
To deal with this problem, you can download the Nuget Package called DotNetSeleniumExtras.WaitHelpers. Then, just reference the appropriate namespace in your files.
Also, don’t forget to do this in your using statements so that ExpectedConditions is being used from the correct Nuget package:
using ExpectedConditions = SeleniumExtras.WaitHelpers.ExpectedConditions;