Skip to content

Commit f2b33bc

Browse files
authored
Support Selenium 3.6.0 and 3.7.0 with driver.switch_to.active_element (#999)
Fixes #998
1 parent 9cfccca commit f2b33bc

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/SeleniumLibrary/keywords/element.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -240,10 +240,10 @@ def element_should_be_focused(self, locator):
240240
New in SeleniumLibrary 3.0.
241241
"""
242242
element = self.find_element(locator)
243-
if self.driver.capabilities['browserName'] != "firefox":
244-
focused = self.driver.switch_to.active_element
245-
else:
246-
focused = self.driver.execute_script('return document.activeElement;')
243+
focused = self.driver.switch_to.active_element
244+
# Selenium 3.6.0 with Firefox return dict wich contains the selenium WebElement
245+
if isinstance(focused, dict):
246+
focused = focused['value']
247247
if element != focused:
248248
raise AssertionError("Element '%s' does not have focus." % locator)
249249

0 commit comments

Comments
 (0)