上QQ阅读APP看书,第一时间看更新
DOM traversal
Now that we have seen the basic definitions of XPaths and CSS and also looked at what WebElements are, let's understand how we can use these to exploit the DOM. DOM traversal entails getting to the desired element with the help of either XPaths or CSS. It is possible to traverse the DOM in a forward and backward direction with XPaths but traversal through XPaths is slow compared to CSS. Traversal using CSS can only be done in the forward direction. In order to traverse the DOM, using either XPaths or CSS, we need to understand the By class.