Selenium / Quiz
getDomAttribute vs getDomProperty: The Truth in the DOM
Markup says value=draft, the user typed final. Which API tells which truth, and why the old getAttribute was a diplomatic compromise.
- Difficulty
- Hard
- Format
- Quiz
- Points
- 200
- Estimate
- 10 min
// MISSION BRIEF
Your Mission
Selenium 4 split the ambiguous old getAttribute() into two precise questions: getDomAttribute() asks what the HTML MARKUP declared; getDomProperty() asks what the LIVE DOM currently holds.
Typed inputs, checkboxes, resolved URLs, and the class-vs-className rename are exactly where the two answers diverge. This quiz makes you fast at predicting both.
// FIRST CONTACT
Battle teaser
The core split between the two Selenium 4 APIs:
- AgetDomAttribute reads the attribute as written in the HTML source; getDomProperty reads the current property value from the live DOM object
- BgetDomProperty only works on form elements
- CThey are aliases kept for backwards compatibility
- DgetDomAttribute includes CSS styles, getDomProperty does not
Answers, scoring, hints, and the full battle stay sealed.
// SKILL TAGS
seleniumjavadomattributes