2

I have a selenium script that works fine locally, as well as when run on the command line of the build machine. But when I run through Jenkins, I am getting different results. (this is a continuation of an earlier post - asking as a new question because I think it's a different issue)

My intention is to enter the field data, press Enter, press Tab to leave field/fire the javascript - this will cause a new field (formOrBundleType) to appear.

    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");  

In Jenkins, I am getting:

[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

I've changed all kinds of timing settings, to see if the issue is with the return from the javascript call/painting the form. Has anyone else run into this?

Community
  • 1
  • 1
user725861
  • 150
  • 1
  • 2
  • 7
  • Can you add a line of code like selenium.isVisible(locator) before selenium.keypress and see what value its returning? – A.J May 30 '12 at 18:16
  • I found a workaround, by selecting the previous field: selenium.keyPress("program", "\10"); --- this action causes the event to fire / expose the new field. Not the best solution, but its effective. Thank you for your feedback! – user725861 Jun 01 '12 at 20:33

0 Answers0