我有一个 selenium 脚本,可以在本地运行,也可以在构建机器的命令行上运行。但是当我运行 Jenkins 时,我得到了不同的结果。(这是较早帖子的延续- 作为一个新问题提出,因为我认为这是一个不同的问题)
我的意图是输入字段数据,按 Enter,按 Tab 离开字段/触发 javascript - 这将导致出现一个新字段(formOrBundleType)。
selenium.keyPress("program", "\10");
selenium.type("program", "MIC HOMEOWNERS");
selenium.keyPress("program", "\10");
// slight hack - tabbing out of this field forces the form
// to repaint, exposing the formOrBundleType field
selenium.keyPressNative(java.awt.event.KeyEvent.VK_TAB + "");
// now grab the exposed field and start the data entry again
selenium.keyPress("formOrBundleType", "\10");
selenium.type("formOrBundleType", "HO3 ENHANCED");
在詹金斯,我得到:
[junit] 13:59:48.761 INFO - Command request: type[program, MIC HOMEOWNERS] on session 44eb
[junit] 13:59:54.761 INFO - Got result: OK on session 44eb
[junit] 13:59:54.776 INFO - Command request: keyPress[program, ] on session 44eb
[junit] 14:00:00.776 INFO - Got result: OK on session 44eb12edb47f4a14aa2f3c7733f2ff52
[junit] 14:00:06.776 INFO - Command request: keyDownNative[9, ] on session 44eb
[junit] 14:00:06.776 INFO - Creating Robot
[junit] 14:00:06.792 INFO - Got result: OK on session 44eb
[junit] 14:00:13.105 INFO - Command request: keyPress[formOrBundleType, ] on session 44eb
[junit] 14:00:19.105 INFO - Got result: ERROR: Element formOrBundleType not found on session 44eb
我已经更改了各种时间设置,以查看问题是否与 javascript 调用/绘制表单的返回有关。有没有其他人遇到过这个?