Cannot click "clickable" elements enclosed in div or span tags

602 views
Skip to first unread message

Viyat Bhalodia

unread,
Jun 4, 2014, 9:02:12 AM6/4/14
to seleniu...@googlegroups.com
I have seen many people mention such a bug, that Selenium for python doesn't click on elements enclosed specifically between <div> tags or <span> tags.

To reproduce it, 

from selenium import webdriver

browser = webdriver.Firefox()
browser.get("http://google.ie"
a = brower.findall_elements_by_tagname("a")
for element in a:
    print element.tag
    if element.is_visible:
        print "yes"
        element.click()
    else:
        print "no"
        pass


Please reply as fast as possible.

Thank you very much,

David

unread,
Jun 5, 2014, 12:09:30 AM6/5/14
to seleniu...@googlegroups.com
It would help if you offered specific element examples on that site rather than getting all links on page then clicking them if they're visible.

Also, your WebDriver method calls are incorrect or outdated. They should be

a = browser.find_elements_by_tag_name("a")

element.is_displayed() # or element.is_displayed w/o ()

and you forgot the ending ')' in browser.get()
Reply all
Reply to author
Forward
0 new messages