Reputation: 3538
I tried this in the browser and it works fine:
('button[data-item-id="1054079703"]')[0].click()
When I try it with Splinter:
browser.find_by_css('button[data-item-id="1054079703"]')
returns a Splinter object:
[<splinter.driver.webdriver.WebDriverElement object at 0x1108c6c90>]
I can see that it's finding the right element:
browser.find_by_css('button[data-item-id="1054079703"]').first.html
u'this_is_what_im_looking_for'
But when I goto click it:
browser.find_by_css('button[data-item-id="1054079703"]').first.click()
I'm getting the error:
selenium.common.exceptions.ElementNotVisibleException: Message: element not visible
To verify, this returns False
browser.find_by_css('button[data-item-id="1054079703"]').first.visible
How come I can select it in the browser using jQuery, but it's not visible through Splinter?
Upvotes: 0
Views: 665
Reputation: 12265
Sometimes for whatever reason, selenium will determine that an element is not visible when indeed it is.
Best to check your css to make sure nothing is overlaying it just to be sure.
If you are sure that it is visible, try using execute_script
browser.execute_script("document.getElementsByClassName('myclass')[0].click()")
Upvotes: 1