ahalbert
ahalbert

Reputation: 51

Hidden HTML Elements in Selenium's web driver(python)

I'm writing test scripts for a web page in python using Selenium's remote control interface.

I'm writing it like this:

elem = browser.find_element_by_link_text("foo")
elem.click()
elem = browser.find_element_by_name("goo")
elem.send_keys("asdf")
elem = browser.find_element_by_link_text("foo2")
elem.click()

It then needs to select an item in a list. The list becomes visible when the mouse hovers over it, but selenium cannot find the element if it's hidden. The list also shows options based on who is logged in. The list is implemented in CSS, so trying to run it in javascript and using gettext() does not work.

I've tried searching for the link based on name, class and xpath, but it always reports that it is not visible I've verified from browser.page_source() that the link is in the source code, so it's reading the correct page.

How do I select the link inside the list? Any help is appreciated.

Upvotes: 1

Views: 2558

Answers (2)

Nam Ngo
Nam Ngo

Reputation: 2163

Try move_to_element(). Check out the API http://readthedocs.org/docs/selenium-python/en/latest/api.html

Upvotes: 0

ernie
ernie

Reputation: 6356

Selenium and :hover css suggests that this can't be done using the Selenium RC interface, but instead must be done using the WebDriver API

Upvotes: 1

Related Questions