如果只有颜色发生变化,如何检测 Webelement 的状态 [英] How to detect the state of a Webelement if only it's colour changes

查看:29
本文介绍了如果只有颜色发生变化,如何检测 Webelement 的状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题是:我有一个应用程序,我必须决定一个元素的状态.元素可以有两种状态,在位置 1 - 它在位置 2 有黑色背景 - 它有白色背景.它没有其他任何变化,大小、值、名称、可见性和启用值都没有改变……只有背景颜色.

My problem is this: I have an application and I have to decide the state of an element. The element can have two states, in position number 1 - it has black background in position number 2 - it has white background. Nothing else changes on it, nor it's size, nor it's value, nor it's name, nor it's visibility, nor it's enabled value nothing... Only it's background colour.

想象一下,如果你在屏幕上有一个按钮,点击它只会改变它的背景.

Imagine it like if you had a button on the screen and tapping on it changes only it's background.

你知道我该怎么做才能获得这个 webelement 的状态吗?

Do you have any idea what could I do in order to get the state of this webelement?

推荐答案

如果我理解正确,您想用背景颜色来标识元素.你可以用 SikuliX Java api

If I understand it correctly , you want to identify the element with its background color. You can do that with SikuliX Java api

最简单的方法是如何设置 SikuliX"下的选项 2 和 这里 是如何将它与 Java 一起使用(使用 Maven,因此您拥有所有依赖项)

The easiest way is Option 2 under "How do I set up SikuliX" and here is how to use it with Java (with Maven, so you have all the dependencies)

这里是我用 SikuliX 做的一个项目,以防万一帮助.

here is a project I did with SikuliX, in case it is of any help.

我不确定,如果您尝试在移动设备上执行此操作,但我认为现在它不能用于移动设备,如先决条件中所述.

I am not sure , if you are trying to do it in mobile but I think right now it can not be used with mobile devices, as mentioned in pre-requisites.

这篇关于如果只有颜色发生变化,如何检测 Webelement 的状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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