硒的webdriver +蟒蛇 - 无法鼠标动作后隐藏工具提示 [英] Selenium Webdriver + python - Not able to hide the tooltip after mouse over action

查看:184
本文介绍了硒的webdriver +蟒蛇 - 无法鼠标动作后隐藏工具提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用webdriver的硒与Firefox我的网页上测试的工具提示。

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?

推荐答案

如果您有多个提示,确保您不会重复使用相同的对象ActionChains。
我环在我的提示,像这样:

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()

这篇关于硒的webdriver +蟒蛇 - 无法鼠标动作后隐藏工具提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆