What will you learn in this course?
Are you struggling with working with HTML using Selenium WebDriver? Do you know how to easily identify and manipulate an element using Selenium WebDriver? How about performing a drag n’ drop on an element? If not, then these are just a few of the questions that will be answered in this course.
This course is a complete guide on working with web elements in Selenium WebDriver! Once you are finished with this course, you will know how to work with any web elements, anytime, on any web application.
In this course from Ultimate QA, you will learn:
– Basics of HTML
– All the different locator strategies for Selenium WebDriver
– How to identify web elements using Selenium WebDriver
– Master XPath
– Navigation with Selenium WebDriver
– Web element manipulation
– Web element interrogation
– Mouse and keyboard actions with Selenium WebDriver
– Performing actions such as drag n’ drop, drawing, hovering
– Implicit and Explicit waits
– How to properly handle element identification so that your tests are not flaky
– Expected Conditions in Selenium WebDriver
What will you learn in this lecture?
In this video, we will go through the process on working with tabs and toggles of the Elements Identification course.
Selenium Tutorial – Working with Tabs and Toggles
All right ladies and gents How about we work on some advanced controls like opening a toggle so if you come over here and you see a toggle here and you click on it here’s what we get engaged him out. By the way let me actually show you what it does. If I click on it see that it opens up this text that we can’t read. So to click on and you guys see it has a clue. Yes. So let’s use that class and see if it gets was the right identifier removal of that class. Equals excellent. So it does work for us. We can use a class to identify this toggle. Now if there were two toggles that I created they would probably have the same class and then that would not work. And then you would need to use some other identifier to open and close the toggle.
But in the meantime it works. And then you can use that to read the text that’s in here. All right so you can see that text lives inside of the toggle and then once it’s open it’s the. And inside of there there is some text. Now how about tabs. You guys see the tabs over here. So if I click on this one this is tab. If I click on this one this is Tab 1. See how the text changes there and how the tabs actually become black when they’re selected. So how can you click on the appropriate tab. Well let’s take a look.
So if you use our Firebug to highlight here you can first of all see that it has a link and it’s has text and size called type 2 and it has an track which is just the hash tag. And it’s also a class of each tab active. How about this other one that’s not active has like class of blank and then it’s a trap as this. So if we want to click on tab one we can do something like an A and then it contains text.
Open close brackets text comma and the string and we’ll put them here. 1. Make sure you close this bracket here. Square Bracket enter and it’s still. If we want to select contain or two or tab to just hit up to that selected and we can probably even take it a step further and not require a. And just give it a star and that actually makes it even better more stable because we’re not dependent on having a tag and where it can be any tagon as long as it contains type 2 but we’re happy or to have one that will also work and you can even decide if a certain Taieb is active by doing something like an ally.
So we do that. And then inside of that we have our a living. Right. So if we hit enter here that did not work. Now why is that. Guys why does anyone decide to figure out why it doesn’t work. Well it’s actually pretty simple because tab won which we have here is not active. It’s tab to that is active. See that how it works because tab to has this class in its active tab one is not.
So it does not work. So using selenium driver we can just check to see for example if this web element is returned. If not then we know that it’s not active and that’s how we can decide which tab to click or even better we can just click on the appropriate type whether it’s active or not. And so that’s how you work with tabs and then if whenever you open one up you can go inside and just read the text.