Skip to content

Commit 35350fc

Browse files
authored
Removes support for passing attribute in locator for Get Element Attribute kw (#1190)
* Removes support for passing attribute in locator for Get Element Attribute kw * Remove not needed unit test
1 parent 56c27e5 commit 35350fc

File tree

3 files changed

+7
-28
lines changed

3 files changed

+7
-28
lines changed

atest/acceptance/keywords/elements.robot

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,22 +40,19 @@ Assign Id To Element
4040
Page Should Not Contain Element my id
4141

4242
Get Element Attribute
43-
${id}= Get Element Attribute link=Link with id@id
43+
${id}= Get Element Attribute link:Link with id id
4444
Should Be Equal ${id} some_id
45-
${id}= Get Element Attribute dom=document.getElementsByTagName('a')[3]@id
45+
${id}= Get Element Attribute dom:document.getElementsByTagName('a')[3] id
4646
Should Be Equal ${id} some_id
47-
${class}= Get Element Attribute second_div@class
47+
${class}= Get Element Attribute second_div class
4848
Should Be Equal ${class} Second Class
4949
${id}= Get Element Attribute link=Link with id id
5050
Should Be Equal ${id} some_id
51-
${element_by_dom}= Get Webelement dom=document.getElementsByTagName('a')[3]
52-
${id}= Get Element Attribute ${element_by_dom} id
53-
Should Be Equal ${id} some_id
5451
${second_div}= Get Webelement second_div
5552
${class}= Get Element Attribute ${second_div} class
5653
Should Be Equal ${class} Second Class
5754

58-
Get Element Attribute Value Should Be Should Be Succesfull
55+
Get Element Attribute Value Should Be Should Be Succesfull
5956
Element Attribute Value Should Be link=Absolute external link href http://www.google.com/
6057

6158
Get Element Attribute And Element Attribute Value Should Be Should have same results

src/SeleniumLibrary/keywords/element.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ def element_text_should_not_be(self, locator, not_expected, message=None, ignore
364364
raise AssertionError(message)
365365

366366
@keyword
367-
def get_element_attribute(self, locator, attribute=None):
367+
def get_element_attribute(self, locator, attribute):
368368
"""Returns value of ``attribute`` from element ``locator``.
369369
370370
See the `Locating elements` section for details about the locator
@@ -373,14 +373,10 @@ def get_element_attribute(self, locator, attribute=None):
373373
Example:
374374
| ${id}= | `Get Element Attribute` | css:h1 | id |
375375
376-
Passing attribute name as part of the ``locator`` is deprecated
377-
since SeleniumLibrary 3.0. The explicit ``attribute`` argument
376+
Passing attribute name as part of the ``locator`` was removed
377+
in SeleniumLibrary 3.2. The explicit ``attribute`` argument
378378
should be used instead.
379379
"""
380-
if is_noney(attribute):
381-
self.warn("Using 'Get Element Attribute' without explicit "
382-
"attribute is deprecated.")
383-
locator, attribute = locator.rsplit('@', 1)
384380
return self.find_element(locator).get_attribute(attribute)
385381

386382
@keyword

utest/test/keywords/test_keyword_arguments_element.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,6 @@ def test_element_text_should_be(self):
3535
with self.assertRaisesRegexp(AssertionError, 'foobar'):
3636
self.element.element_text_should_be(locator, 'not text', 'foobar')
3737

38-
def test_get_element_attribute(self):
39-
locator = '//div'
40-
attrib = 'id'
41-
element = mock()
42-
when(self.element).find_element(locator).thenReturn(element)
43-
when(element).get_attribute(attrib).thenReturn('value')
44-
value = self.element.get_element_attribute(locator, attrib)
45-
self.assertEqual(value, 'value')
46-
47-
when(logger).warn("Using 'Get Element Attribute' without explicit "
48-
"attribute is deprecated.", False).thenReturn(None)
49-
value = self.element.get_element_attribute('//div@id', 'None')
50-
self.assertEqual(value, 'value')
51-
5238
def test_get_matching_xpath_count(self):
5339
locator = '//div'
5440
when(self.element).find_elements('xpath:' + locator).thenReturn([])

0 commit comments

Comments
 (0)