17. Using Get WebElements | Using Get Element Count

Опубликовано: 21 Январь 2025
на канале: Tech Edinam
100
3

We will be using the Get WebElements to retrieve some elements on the page that matches a particular locator. But the Get WebElements alone is not enough. We will have to use the Get Length keyword to know the number of elements the Get WebElements keyword returned.

With the help of the For loop, we can click through all the elements in the list.
But it seems since the table component reloads every time an element disappears from the page, it later causes some problems. Even though the elements to be clicked are visible to the naked eye, their references would have changed due to the refresh. That is where the Get Element Count comes in.

With the Get Element Count, we get the number of elements matching a specific locator. We then use the For loop to click through the elements with a specific locator.


==========================================================
If you would like to use the web apps I run locally during the tutorials, you can download them from my github page with this link https://github.com/techEdinam/resourc...


-When you have visited that link from above, make sure you are in the master branch and click the "Code" button. A dropdown appears with two tabs; Local, and Codespaces. Make sure the "Local" tab is selected and click the "Download ZIP" link. That should download the entire resources repository to the "Downloads" folder or any destination you chose on your computer.

-Extract the files by right-clicking on the downloaded folder and click "Extract all".
When the extraction is done, you can copy the "resources" folder to any other location you prefer. Whether on the desktop or in your documents folder. Feel free to rename the folder from "resources-master" to "resources"

-Now, with your preferred IDE or text editor, open the "resources" folder by going to File menu and clicking on open folder, and choose the "resources" folder. The project should be displayed on the left hand side of the text editor/IDE by default

-Any file ending with the extension .html can be opened by right-clicking that file and clicking on open.
Some of the projects were created using react.js. These projects will have a readme.md in them on how to get things started for example that of the "registration" project. It is recommended to read those readme files before starting.

If there are questions, leave a comment. Thank you :)