Is there a difference between expect(locator).to_be_visible()
and locator.wait_for()
? Should I prefer one over the other?
I’ve looked up the __doc__
s:
wait_for
: Returns when element specified by locator satisfies thestate
option. (state
defaults to'visible'
).to_be_visible
: Ensures that Locator points to an attached and visible DOM node.
Still, not very clear. Is it possible for a locator to be visible but not attached? If so, would they be equal if I know for sure that the located element is attached?