selenium-webdriver - 使用 gojs 实现 UI 自动化
问题描述
有没有关于如何彻底使用 gojs 进行 UI 自动化的文档?我只想将托盘上的控件拖放到画布上以创建流程图。请帮忙。我只需要指向一个教程或参考即可开始。
解决方案
我不确定您到底要什么,但是您是否使用 Robot 类来模拟用户输入? https://gojs.net/latest/extensions/Robot.html
// a shared Robot that can be used by all commands for this one Diagram
robot = new Robot(myDiagram); // defined in Robot.js
然后可以执行以下操作:
function clickLambda() {
var lambda = myDiagram.findNodeForKey("Lambda");
if (lambda === null) return;
var loc = lambda.location;
// click on Lambda
robot.mouseDown(loc.x + 10, loc.y + 10, 0, { });
robot.mouseUp(loc.x + 10, loc.y + 10, 100, { });
// Clicking is just a sequence of input events.
// There is no command in CommandHandler for such a basic gesture.
}
或者:
function dragFromPalette() {
// simulate a drag-and-drop between Diagrams:
var dragdrop = { sourceDiagram: myPalette, targetDiagram: myDiagram };
robot.mouseDown(5, 5, 0, dragdrop); // this should be where the Alpha node is in the source myPalette
robot.mouseMove(60, 60, 100, dragdrop);
robot.mouseUp(100, 100, 200, dragdrop); // this is where the node will be dropped in the target myDiagram
// If successful in dragging a node from the Palette into the Diagram,
// the DraggingTool will perform a transaction.
}
推荐阅读
- python - 如何使用 SQL Alchemy 在 SQL Server 中创建图形节点表?
- python - 使用 BeautifulSoup 附加表,使其工作?
- flutter - 数量增加减少显示计数器字段
- javascript - 如何使用 Vuetify.js 的 v-simple-table 将标题放在第一列?
- python - 无法从 Visual Studio 代码解释器更改 python 版本
- ios12 - ios 12 浏览器中的 Samesite 问题
- kotlin - 如何在 Kotlin 中跳过泛型类型参数的规范?
- c++ - 为什么我会发出叮当声:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用)
- react-native - 使用 react native 从 api 修改时刷新屏幕
- android - ID 在 MainActivity.kt 中显示为未解析的引用