1

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.

3
  • We need more information. How does the hover over work? Is it CSS or JS? Commented Jun 15, 2011 at 17:31
  • It is implemented in CSS Commented Jun 15, 2011 at 17:47
  • If you know the offset of the list, you can use move_by_offset(xoffset, yoffset). Read more here. Commented Nov 5, 2013 at 7:09

2 Answers 2

1

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

Sign up to request clarification or add additional context in comments.

1 Comment

browser is a webdriver object, is that what the webdriver API is?
0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.