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

Skip to content

Commit 5b74012

Browse files
author
Baiju Muthukadan
committed
Locating Elements by Class Name
1 parent cc98625 commit 5b74012

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

source/locating-elements.rst

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ strategy, the first element with the link text value matching the
193193
location will be returned. If no element has a matching link text
194194
attribute, a ``NoSuchElementException`` will be raised.
195195

196-
For instance, conside this page source::
196+
For instance, consider this page source::
197197

198198
<html>
199199
<body>
@@ -230,4 +230,23 @@ The heading (h1) element can be located like this::
230230

231231
heading1 = driver.find_element_by_tag_name('h1')
232232

233-
233+
234+
Locating Elements by Class Name
235+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
236+
237+
Use this when you want to locate an element by class attribute name.
238+
With this strategy, the first element with the matching class attribute
239+
name will be returned. If no element has a matching class attribute name,
240+
a ``NoSuchElementException`` will be raised.
241+
242+
For instance, consider this page source::
243+
244+
<html>
245+
<body>
246+
<p class="content">Site content goes here.</p>
247+
</body>
248+
<html>
249+
250+
The "p" element can be located like this::
251+
252+
content = driver.find_element_by_class_name('content')

0 commit comments

Comments
 (0)