robotframework - 如何让sikuli专注于桌面屏幕

标签 robotframework sikuli

我正在使用 VS CODE 来开发一个带有 Robot Framework 和 Sikuli 的机器人。当我运行脚本时出现错误

"could not find P(sage.png)"

发生这种情况是因为当前屏幕是 VS CODE 的屏幕,而不是“sage.png”所在的桌面。

我可以在脚本中使用什么来首先关注桌面屏幕?

最佳答案

我刚刚查看了sikuli的文档。 您可以使用以下方法,他们已经专门讨论了您的问题。

classmethod focusedWindow()

On Windows, this method always returns a region. When there is no window opened on the desktop, the region may refer to a special window such as the task bar or an icon in the system tray.

# highlight the currently fontmost window for 2 seconds
App.focusedWindow().highlight(2)

# save the windows region before
firstWindow = App.focusedWindow()
firstWindow.highlight(2)

关于robotframework - 如何让sikuli专注于桌面屏幕,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59218851/

相关文章:

java - 在java中使用sikuli为firefox设置代理

robotframework - 变量文件中的变量

list - 如何在Robot Framework中将全局变量或套件变量设置为列表?

python - 如何使用 Sikuli 中的 “type” 函数检查变量类型

java - 关闭jar文件压缩

python - 如何在机器人框架内运行sikuli脚本?

RobotFrameWork- 一些库未导入

android - Robotframework 中的多个设备连接错误

python-2.7 - 如何从python中的日期时间字符串中删除秒和毫秒

process - 如何暂停,恢复和停止Sikuli程序?