Java – webelement or webdriver calls findelement method?

What's the difference if we use webelement or webdriver to call the findelement method? Does each of them have an advantage? Thank you in advance

Solution

The difference between the findelement of webelement and webdriver lies in the context

The context of webdriver is the current page, and the context of webelement is the element Webdriver will search the entire document, and webelement will try to find the first child element from this node

Please note that when using webelement through XPath to search, the whole document will still be searched from / /, not just the children of the current node You can use// Restrict search results to children of this webelement

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>