27

これは、少なくともJava APIでは、webdriverでホバー/マウスオーバーを行う方法のようです:

Actions action = new Actions(driver);
action.moveToElement(element).build().perform();
action.moveByOffset(1, 1).build().perform();

これは Python API で可能ですか? python の webdriver api docs は、そのようなものについて何も言及していないようです。 http://selenium.googlecode.com/svn/trunk/docs/api/py/index.html

Python webdriverでホバー/マウスオーバーはどのように行われますか?

4

2 に答える 2

39
from selenium.webdriver.common.action_chains import ActionChains


def hover(self):
    wd = webdriver_connection.connection
    element = wd.find_element_by_link_text(self.locator)
    hov = ActionChains(wd).move_to_element(element)
    hov.perform()
于 2012-06-19T19:57:43.813 に答える