File tree Expand file tree Collapse file tree 3 files changed +18
-1
lines changed
src/Selenium2Library/keywords Expand file tree Collapse file tree 3 files changed +18
-1
lines changed Original file line number Diff line number Diff line change 11Release Notes
22=============
33
4+ 1.7.3 (unreleased)
5+ -------------------
6+ - Added 'Get WebElement' [zephraph][emanlove]
7+
481.7.2
59----------------
610- Added an argument called screenshot_root_directory that can be passed into S2L's
Original file line number Diff line number Diff line change @@ -21,6 +21,13 @@ def __init__(self):
2121
2222 # Public, get element(s)
2323
24+ def get_webelement (self , locator ):
25+ """Returns the first WebElement matching the given locator.
26+
27+ See `introduction` for details about locating elements.
28+ """
29+ return self ._element_find (locator , True , True )
30+
2431 def get_webelements (self , locator ):
2532 """Returns list of WebElement objects matching locator.
2633
Original file line number Diff line number Diff line change @@ -7,6 +7,13 @@ Get Elements
77 @{links } = Get WebElements //div[@id="div_id"]/a
88 Length Should Be ${links } 11
99
10+ Get Web Element
11+ @{links } = Get WebElements //div[@id="div_id"]/a
12+ ${link } = Get WebElement //div[@id="div_id"]/a
13+ Should Be Equal @{links } [0 ] ${link }
14+ Run Keyword and Expect Error ValueError: Element locator 'id=non_existing_elem' did not match any elements.
15+ ... Get WebElement id=non_existing_elem
16+
1017More Get Elements
1118 [Setup] Go To Page "forms/prefilled_email_form.html"
1219 @{checkboxes } = Get WebElements //input[@type="checkbox"]
@@ -51,4 +58,3 @@ Get Vertical Position
5158 ${pos } = Get Vertical Position link=Link
5259 Should Be True ${pos } > ${0 }
5360 Run Keyword And Expect Error Could not determine position for 'non-existent' Get Horizontal Position non-existent
54-
You can’t perform that action at this time.
0 commit comments