Use the HTML IDÂ attribute to locate elements in Selenium.
- [Instructor] The very first step in test automation is to…locate HTML elements.…Let's take a look at locating elements using the id…attribute along with a code example for the same.…The HTML id attribute specifies a unique id…for an HTML element.…The rules for the id attribute are:…it must contain at least one character,…it must not contain any space characters,…the id value is case sensitive,…and it must be unique in a document.…
We use this method to locate elements when the id attribute…of an element is known.…The first element with a matching attribute…value will be returned.…Let's go ahead and try a hands-on on how to locate…the elements using the id attribute.…I'm going to head over to the exercise files where…under chapter two I have an HTML code file that we will…be using for the whole of chapter two to run our code.…
So I'm going to open this script with sublime text.…As you can see, we have a form element with id loginform.…We'll be writing a python script to…locate this form element.…I'm going to head over to the exercise files again…
Author
Released
6/1/2018- What is automated testing?
- Python-Selenium bindings
- Parsing the DOM structure
- Locating elements in the DOM
- Navigating and interacting with pages
- Explicit and implicit waits
Skill Level Intermediate
Duration
Views
Related Courses
-
Learning Python GUI Programming
with Burkhard Meier6h 6m Intermediate -
Python Essential Training
with Bill Weinman4h 45m Intermediate -
Learning Python Web Penetration Testing
with Christian Martorella2h 49m Intermediate
-
Introduction
-
Welcome1m 11s
-
What you should know1m 6s
-
Using the exercise files1m 30s
-
-
1. What Is Automation Testing and Python-Selenium Framework?
-
Python-Selenium bindings4m 9s
-
A simple code example1m 23s
-
Cross-browser support4m 8s
-
2. Parsing the HTML DOM Structure
-
Locating elements by ID5m 22s
-
Locating elements by XPath6m 18s
-
Challenge1m 20s
-
Solution6m 11s
-
3. Navigating through Pages
-
Page interaction3m 44s
-
Filling forms6m 45s
-
Drag and drop elements4m 33s
-
Challenge1m 6s
-
Solution5m 45s
-
-
4. Waits
-
Explicit waits5m 2s
-
Implicit waits3m 25s
-
Conclusion
-
Next steps57s
-
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.
CancelTake notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.
Share this video
Embed this video
Video: Locating elements by ID