views:

535

answers:

3

I am testing a JQuery Web application. I have a JQuery popup that I simply cannot get the submit button to fire in Watir. The same pattern is used thought the application.

I have verified the button exists and have tried click, fireEvent you name it and am out of methods to call.

Has anyone solved this?

+1  A: 

Hi,Which do you want ?
A. Control cursor and click "submit"
or
B. Simula te click "submit"

A:need to use Autoit and control cursor and click ,but only for windows OS. B:execute the javascript that when clicking "submit".

If B case,there is two ways I used always.
1.execute that code in URL-bar.
ex.) @ie.link(:URL, 'javascript:<-CODE->;').click
or
Make like that module and use it by include in test case.
ex.) @ie.excute_script(<-CODE->)

module Watir
  class IE
   def execute_script(scriptCode)
     WIN32OLE.codepage = WIN32OLE::CP_UTF8
     window.execScript(scriptCode)
   end
   def window
     WIN32OLE.codepage = WIN32OLE::CP_UTF8
     ie.Document.parentWindow
   end
  end

Maybe...
I hope it help.
Sorry my poor english.
tknv/

tknv
+1  A: 

In my case the solution was to use and index value of 1. JQuery creates a copy of the form and all the popup items have an index of 1. The 0 index controls are on the original form.

Gary
A: 

I just had the same problem. Ajax upload for jQuery demo is an example page. I want to upload a file using Upload button on the left hand side of the page.

When I click Upload button by hand, file upload pop up appears.

When I click the button with Watir, nothing happens.

Gary (accepted answer) helped me to find a solution:

browser.file_field(:index, 1).set "/path/to/file"
Željko Filipin