Created
April 26, 2012 14:48
-
-
Save knorrium/2500088 to your computer and use it in GitHub Desktop.
WebDriver Element focus test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from selenium import webdriver | |
driver = webdriver.Chrome() | |
driver.get("http://dev.knorrium.info/wd/focus_test.html") | |
driver.find_element_by_id("btnFocus").click() | |
element = driver.find_element_by_id("myAnchor") | |
focused_element = driver.switch_to_active_element() | |
#wouldn't a if (element == focused_element) make sense? | |
if element.__dict__ == focused_element.__dict__: | |
print "myAnchor element is focused" | |
else: | |
print "myAnchor element is not focused" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment