Selenium Webdriver + python - Not able to hide the tooltip after mouse over action

妖精的绣舞 提交于 2019-12-06 08:54:52

问题


I am testing tooltips on my web page using Selenium WebDriver with Firefox.

I'm trying to hover over the element that has the tooltip attached. To test that the tooltip is displayed and then to hover over another element and test its respective tooltip.

element_to_click = claim_section.find_element_by_class_name("arrowBox")
hover_mouse = ActionChains(self.driver).move_to_element(element_to_click)
hover_mouse.perform()

At any given time, we see only one tooltip when I test it manually. But when I run this test the first tooltip does not hide. I tried to move over another element on the page but the tooltip remains visible.

Am I missing any other action here and what are the possible solutions?


回答1:


If you have multiple tooltips make sure that you don't reuse the same ActionChains object. I loop over my tooltips like so:

for element in elements:
    ActionChains(self.driver).move_to_element(element).perform()


来源:https://stackoverflow.com/questions/16426416/selenium-webdriver-python-not-able-to-hide-the-tooltip-after-mouse-over-acti

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!