Python Selenium:在鼠标指针上显示工具提示(Three.js / React / Canvas)

时间:2018-03-28 16:04:48

标签: python reactjs selenium canvas three.js

所以这是一个棘手的情况。使用Three.js / ReactJS和canvas。

Scenario: When I click and drag a sphere beyond its boundaries a tooltip will show a warning message over the mouse pointer. When I release the mouse the tooltip will disappear. When I click and drag the sphere back to a position inside the boundaries, the tooltip will not be displayed once inside the boundaries.

请记住,这与由react处理的应用程序状态相关联,并且在此实例中,当条件在状态中满足并更新时,工具提示正在更新。

但是,工具提示元素存在,当球体超出范围时,属性和内容会在点击并保持时更新... 使用

ActionChains(page.driver).move_to_element_with_offset(sphere_order_panel, -1047, 398).click_and_hold().move_to_element_with_offset(sphere_order_panel, -1633, 265).click_and_hold().perform()

点击元素并将其拖动到其边界之外的位置,但工具提示未更新...我手动点击页面后在页面上放置断点,我的球体被捕捉到我的鼠标位置(意味着click_and_hold确实有效......但是我检查了html并确认工具提示没有更新。但是如果我手动使用我的鼠标并点击球体,工具提示将更新!是selenium自动化不是正确执行click_and_hold?我不认为是这种情况。

有没有办法使用selenium将鼠标指针添加到页面?

或者有没有办法使用execute_script()在页面上使用javascript来满足我的条件以更新工具提示?

我真的坚持这个......这是一个棘手的情况(对我来说至少)

任何帮助非常感谢。

1 个答案:

答案 0 :(得分:0)

要解决我的问题,我必须这样做

chain = ActionChains(page.driver).move_to_element_with_offset(sphere_order_panel, -1047, 398).click_and_hold() chain = chain.move_to_element_with_offset(sphere_order_panel, -1047, 398) chain.perform()