What will you learn in this lecture?
In the previous video, we learned how to customize the WebDriverWait. In this video, we will learn the future of ExpectedConditions.
What is the Future of ExpectedConditions
Alright, so now that you know almost everything there is to know about explicit waits and implicit waits, I have an announcement to make that I’ve been trying to tell you. But I needed to teach you and show you everything first so that you can understand that the impact of what has happened.
I’ve actually written a blog post on this topic.
If you want to go to this URL and take a look in more detail but basically about less than two weeks ago selenium 3.11 was released and in there they’ve mentioned that two things are happening.
One of them I’m not so much concerned about but the other one I am very concerned about.
One of the things that they’re doing is they’re removing the page factory from Selenium.
Not a big deal because I don’t teach you how to use it and you shouldn’t really need to use it because it’s very flaky and hard to maintain.
The other huge announcement that they’ve made is that they’re saying goodbye to expected conditions that they’re removing it from the webdriver dotnet implementation.
Yes, that’s right!
What I have just showed you with expectedconditions will no longer be available in the Selenium webdriver API.
Whenever you download the nougat package, look yes it sucks and it’s very annoying.
I talked to Jim Evans and as you see there’s a link there what he told me was that the reason that they’re making these changes is because it’s too hard to maintain the code in Selenium and they want to reduce the complexity and maintenance of the code for selenium and even though expectedconditions are extremely desired and highly used and very user friendly for us, the developers of test automation for whatever reason they’re removing it. I don’t know if I agree with it.
It doesn’t make much sense to me to make something less user-friendly in order for code maintenance.
But again I don’t maintain the Selenium code so I can’t speak to how much maintenance it is now.
Yes it’s very annoying and what you’re gonna have to do is if you don’t use expected conditions, you’re gonna have to now start writing your own linked queries like this.
That’s exactly why I showed you this. You’re gonna need to start writing your own.
These kinds of statements where you can find elements, where you can check elements for texts, where you can check to see if an element exists, where the whether it’s visible whether it’s displayed, all that kind of stuff.
But then, another easier solution is that you can actually download a new special nougat package . Selenium has been kind enough to extract the code into a different nougat package and we can actually use that one instead.
So let me actually show you all of this. So let me pull up my solution Explorer here and I’m gonna come here a right-click and go to manage you get packages for the solution and as you can see I’ve got some updates.
I’m actually on oh wow I’m very outdated on my selenium as you can see some places have three seven some have three four others have three eight so. What I’m gonna do is actually update for you to version 3.11 on both of these.
So I’m gonna go ahead and click all of this of call of that c-sharp doesn’t need that so I’m gonna update all of these to 3.11 and I’m gonna install it give that a second to update. I’m gonna say okay that yes I want to update all of my new get packages to the latest version of selenium they’re all being updated and it’s always a good idea to keep your all your new get packages always on the latest software and all of them to be the same across all projects.
It’s just kind of a quick heads-up while you know everything is downloading figured. I’d give you as much tips as possible so now that we’ve downloaded Selenium webdriver and you get packaged.
Let me go ahead and build and rebuild the code and so now this is going to pull down all of the latest new got packages and and there’s a problem here because you can see that I still have old new got package versions remaining here in my packages folder.
So I’m gonna go ahead and delete them.
I figured that might happen but I thought that a new got package manager would have cleaned it up but it didn’t.
So now, let me go ahead and rebuild again I was getting weird airs about mismatching namespaces in different versions. So now this is still complaining you so what I’m gonna do here is a right click here and go to manage you get packages and then as you can see I have some updates to install and they are for Selenium support.
So I’m gonna go ahead and click this because these are currently version 3.7 but they can be upgraded to version 3.11 which is exactly the version that I just talked about.
So I’m gonna go ahead and click update so that it updates my new get packages in this project webdriver timeouts tutorial so give that a second it’s added all the packages and successfully installed excellent so now let’s go back and look at our output and if we look at the error list what you now can see is this message that expected conditions is obsolete the expected conditions implementations in the.net bindings is deprecated and will be removed in a future release.
This portion of the code has been migrated to dotnet Selenium extras repository on the github so they are super nice to point us to where it has been migrated.
But as they now say this is now obsolete.
You can use it for now but in a future version. It’s going to be gone and it’s going to break your code so you can prepare for that now and I’m gonna show you exactly how so because we’ll even be able to see that in our explicit waits um that you can see there’s a green greed underlined here that says you know expected conditions is obsolete.
So let’s go ahead and fix that and if we by looking at the error list we can see that it says dotnet Selenium extras so if we go into the solution Explorer come here right click do you manage you get packages and browse and we’re gonna go search for dotnet selenium extras so there it is dot net Selenium extras.
We don’t need the page objects but we do need the wait helpers so we’re actually going to install it currently.
As I’m talking to you it’s the end of March 2018 there is still no main maintainer of this repository but it does work so I don’t think it needs many changes and so this version that I’m about to install 3.11 will be just fine so I’m installing it and it’s downloaded.
So now I can go back and and now instead of using support dot UI which we can no longer use and so now of course, this will complain we can use using open QA of selenium extras that wait helpers so that fix that and then, of course, this needs selenium support UI.
There you go so now everything up expected conditions of course is going to complain because it’s ambiguous and so what we have to do is set using static selenium extras dot wait helpers not expected conditions and so now this is gonna be great because the expected conditions using expected conditions means that we’re using these expected conditions not the ones from here.
So whenever the ones from support that you I disappear our code is going to be great and ready because if I hover over you can see that we’re using selenium extras that what wait helpers out expected conditions so now we are all good so as I said although it’s a problem for future code because you’re gonna need to do exactly what I did to fix it and just make sure that you use this new get package to fix all of your future problems.
Sadly, I have no control over this that’s what the Selenium developers decided to do so I just wanted to make sure that you are aware because no one that I know has shown this or shown how to fix these problems yet so I wanted to make sure that you’re one of the first to know how to fix these problems so that you don’t encounter them in the future.
[Tweet “Learn everything you need to know about Selenium Webdriver implicit and explicit waits.”]
Next Tutorial
In the next tutorial, we will take the quiz on proper synchronization.
What will you learn in this course?
Are your automated functional tests flaky? Do they randomly fail and you are unsure why? Is your team frustrated with the “instability” of your Selenium Webdriver tests?
If you are interested in fixing all of these problems and making your tests more stable, then you need to understand how to use all of the different types of waits in Selenium Webdriver. Knowing how to handle synchronization issues will make you a top-notch Test Engineer!
“The best tutorials I have ever seen, simply awesome. I take off my hat in front of you, you are a gorgeous professor, I am speechless to express how satisfied I am with these tutorials.” -Lisbey
In this course from Ultimate QA, you will learn:
– Learn the problems that can occur as a result of improper synchronization.
– Learn how to use Selenium Webdriver explicit waits.
– Master Selenium Webdriver implicit waits
– Understand what a DefaultWait is
– Comprehend how to use all of the different types of waits during appropriate situations
Take This Entire Course for Free
[Tweet “Learn how to correctly use implicit and explicit waits using #Selenium #Webdriver.”]
Great article! Helped me a lot!
Really happy to hear it helped 🙂