当我运行下面的代码时,我观察到'var robot'的最后3行是在开头本身执行的,而不是在单击textArea之后执行的。如何控制代码执行的顺序?
var robot = require("robotjs");
it('Testing robotjs', function () {
browser.driver.get(www.abc.com");
element(by.xpath(button1)).click();
element(by.xpath(textArea)).click();
robot.typeString("hello world");
robot.moveMouse("605", "429");
robot.mouseClick("left");
});
答案 0 :(得分:3)
这是量角器Control Flow的实际应用,将最后3行放入最终点击的承诺解析功能中:
{
"__type": "Root",
"nodes": [
{
"__type": "Ident",
"name": "some-mixin",
"val": {
"__type": "Function",
"name": "some-mixin",
"lineno": 1,
"column": 16,
"params": {
"__type": "Params",
"nodes": [
{
"__type": "Ident",
"name": "a",
"val": {
"__type": "Null"
},
"mixin": false,
"lineno": 1,
"column": 12
},
...