For example, the following html code
Copy codeThe Code is as follows:
<Ul>
<Li class = "aaaa" title = "ttt"> li-1 </li>
<Li class = "bbbb"> li-2 </li>
<Li title = "fffff"> li-2 </li>
</Ul>
& Lt; div class = & lt; aaaa & gt; title = & lt; ttt
Li-2 <div class = "bbbb"> </div>
<Div title = "fffff"> li-2 </div>
First, select E [@ attr] based on the attributes.
$ ("[@ Title]"). click ()..........
That is, select all elements with a title attribute in the element.
That is
<Li class = "aaaa" title = "ttt"> li-1 </li>
<Li title = "fffff"> li-2 </li>
& Lt; div class = & lt; aaaa & gt; title = & lt; ttt
<Div title = "fffff"> li-2 </div>
$ ("Div [@ title]"). click ()..........
Select all elements with title under all div labels
That is
& Lt; div class = & lt; aaaa & gt; title = & lt; ttt
<Div title = "fffff"> li-2 </div>
Second, select E [@ attr = val] based on the attribute value.
$ ("Div [@ title = ttt]"). click ()................
Select all the elements under the div whose title attribute is equal to ttt.
That is
<Div class = "aaaa" title = "ttt"> li-1 </div>
If it is $ ("[@ title = ttt]"). click ()................
All elements whose attribute title is ttt
<Li class = "aaaa" title = "ttt"> li-1 </li>
& Lt; div class = & lt; aaaa & gt; title = & lt; ttt
Third, select E [@ attr ^ = val] based on the Start Letter of the attribute value.
$ ("Div [@ title ^ = t]"). click ()................
All attribute title values under all div elements start with t
Third, select E [@ attr $ = val] based on the Start Letter of the attribute value.
$ ("Div [@ title $ = t]"). click ()................
All attribute title values under all div elements end with t
Third, select E [@ attr * = val] based on the characters in the attribute.
$ ("Div [@ title * = t]"). click ()................
All attribute title values under all div elements are all elements that contain t
Third, select E [@ attr = val] [@ attr = val] based on multiple attributes.
$ ("Div [@ title = ttt] [@ class = aaaa]"). click ()................
All attribute title values under all div elements are equal to ttt and the attribute class is equal to aaaa.