Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cc98625

Browse files
author
Baiju Muthukadan
committed
Locating Elements by Tag Name
1 parent 3ae4e4a commit cc98625

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

source/locating-elements.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,3 +208,26 @@ The continue.html link can be located like this::
208208
continue_link = driver.find_element_by_link_text('Continue')
209209
continue_link = driver.find_element_by_partial_link_text('Conti')
210210

211+
212+
Locating Elements by Tag Name
213+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
214+
215+
Use this when you want to locate an element by tag name. With this
216+
strategy, the first element with the give tag name will be returned.
217+
If no element has a matching tag name, a ``NoSuchElementException``
218+
will be raised.
219+
220+
For instance, conside this page source::
221+
222+
<html>
223+
<body>
224+
<h1>Welcome</h1>
225+
<p>Site content goes here.</p>
226+
</body>
227+
<html>
228+
229+
The heading (h1) element can be located like this::
230+
231+
heading1 = driver.find_element_by_tag_name('h1')
232+
233+

0 commit comments

Comments
 (0)