What will you learn in this lecture?
In the previous video, we learned to work with tabs and toggles of this Selenium WebDriver elements identification course. In this video, we’ll have to learn introduction to HTML tables.
Introduction to HTML Tables
All right! So I think, you guys are getting pretty awesome at using XPath to identify elements.
So I’m going to switch it up on you and get a little bit more complicated. And I want to talk to you guys about HTML tables. They are fun to work with if you like a challenge and really annoying and frustrating, sometimes whenever you can’t get what you need out of them.
So and I’m talking about these exact HTML tables right here. So if we grab our handy Firebug, and take a look, you guys can see that we have multiple different cells. And actually, these cells live inside of rows. And this whole thing right here this table itself.
You guys can see is a table, right? Let’s open up this HTML. And inside of this whole table, we have a body. And inside of that body, we have rows: row 1, 2, 3, 4.
Inside of the rows, we may have headers or we may have table data. Okay? Headers or table data. So you guys can see that, in order to access this table and get what you need out of it.
It can get a little bit hectic sometimes, so let’s go back to one node and learn a little bit about HTML tables.
So HTML tables have a table tag: opening and closing table tag. And inside of that is everything that is going to live related to that table. So when I hover over here, you guys can see that this table tag is what identifies everything inside of my table.
Inside of that table, we have some body tags, right? And that represents the table body. So if I expand here, you guys can see that I have a body tag inside of which have lived all of the cells.
Inside of the body, you can have table rows. So you have a start row tag in, and row tag right and those TRs, TR table row.
When I hover over them, you guys can see what that represents, right? So inside of a table, we have a body inside of the body. We have rows. Okay! Row 1, 2, 3, and 4. And then inside of the rows, you guys can have either headers for TH.
You guys see that on top? Headers or you can have table data. So 1,2, 3. If I add another TD here, it would come out here. If I add a TD 5, it would be over here. So that’s represented in here.
So we have our TRS. And inside of the TRS, we have our TDS that hold the data. Okay? And so that continues for as many rows as you want.
I have 4. If I wanted to add a fifth one, you just add a fifth one. And then inside of that row, you can place some table bodies or you can even place a table header.
If you want to get a little bit crazy, it doesn’t matter. But so that’s the structure of a table. And you guys can see how it may get a little bit complicated, right?
For example, if I want to know what salary a software development engineer in a test can make, then somehow I have to locate the row in which the software development engineering tests live. And then based on the column header, I will locate the salary.
If I want to know how much in automation testing architect makes, I need to locate the row in which the automation testing architect lives. And then get that role and then find the header of the variable that I want, in which case it’s salary.
And then based on the row and column, I can find the exact value that I need. So it gets a little bit tricky.
And let’s go inside of visual studio to better understand it.
[Tweet “Learn everything about elements identification with Selenium Webdriver.”]
Next Tutorial
In the next tutorial, we will cover how to get an HTML table in a variable.
What will you learn in this course?
Are you struggling with working with HTML using Selenium WebDriver? Do you know how to easily identify an element using Selenium WebDrriver? Do you know how to manipulate that web element? Do you know how to perform 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, any time, on any web application.
“Relevant content that I will be able to apply to my automation tests *immediately*, a VERY effective presentation approach (evolving the same example and comparing/contrasting), and an excellent teacher / presenter. Thank you so much for your time and sharing your knowledge Nikolay!.”
-Krissy
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
Take This Entire Course for Free
[Tweet “Learn how to correctly identify elements using #Selenium #Webdriver.”]How