问题
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