简体   繁体   English

将鼠标移至特定颜色像素?

[英]Get mouse to specific color pixel?

Is there a way, perhaps using selenium, to make the mouse pointer get to and hover over a specific color pixel?有没有办法,也许使用 selenium,使鼠标指针到达特定颜色像素上的 hover? I'm trying to get my mouse to get to the pixel in green/white: image.我试图让我的鼠标到达绿色/白色的像素:图像。 I'm trying this to be able to extract the coordinates of each point.我正在尝试这个能够提取每个点的坐标。

The site uses GIS cloud.该站点使用 GIS 云。

I guess this is more a concept question.我想这更像是一个概念问题。

1 Selenium can to to an element with ActionChains 1 Selenium 可以到一个带有ActionChains的元素

    from selenium.webdriver import ActionChains

    actions = ActionChains(driver)
    actions.move_to_element("your_locator")
    actions.click().perform()

2 Selenium can get a pixel color with value_of_css_property function. 2 Selenium 可以通过value_of_css_property function 获得像素颜色。

element_color = your_locator.value_of_css_property("background-image")

I don't really think that you will need to get elements color.我真的不认为您需要获取元素颜色。 You should find its css or xpath locator and move to it with ActionChains .您应该找到它的 css 或 xpath 定位器并使用ActionChains移动到它。

So, ActionChains is what you really need.所以, ActionChains是你真正需要的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM