If I instantiate a WebElement object, will getAttribute calls (and other calls that extract information about the element) successfully return the correct data even if that data changes after the object is created?
I had created an object map of sorts for a table of elements, and so I’m concerned that if I make alterations to any of the elements that are stored in this map, I’ll need to re-set the objects in order to update the map with changes. It made me wonder how Selenium’s WebElement works under the hood: do they read in all the attribute data and other information when they’re created and spit that static data out thereafter, or do they simply contain references to the “real” UI element and retrieve the data dynamically every time?
I believe that it reads the data when you trigger
get Attribute.Get the value of a the given attribute of the element. Will return the current value, even if this has been modified after the page has been loaded.