My Browser (and all the Browsers do this) builds the HTML
web page in memory before it renders it to the screen.
this memory model of the page is called the Document Object Model (DOM)
and we use this DOM to find elements on the page, we are searching
memory
the DOM is a tree structure
Page Title
Header
text
more text
the DOM looks like this:
html
| |
head body
| |
title div
| | |
Page Title <- the contents span span
| |
text more text
I can search the DOM tree using XPath to find an element
to find the element with "text" the XPath is:
/html/body/div/span[1] -> is a WebElement
I now call getText() on this WebElement and I get "text"
to find a spot on the web page, I need to understand the DOM
I really should use the inspect command in my Browser to view
the DOM (and the XPath)