When trying to set a file field that is located within a frame, the "Choose 
File to Upload" dialog never opens, causing the script to timeout.

**Steps to Reproduce - Using w3schools:**

1. Run the following script (using any existing file for upload):

```ruby
require 'watir-classic'
browser = Watir::Browser.new
browser.goto('http://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_input_type_file')
browser.frame(:index, 1).file_field.set('c:\users\jko\desktop\file.txt')
```

--> Notice that the "Choose File to Upload" dialog never opens and that the 
following exception occurs.

```ruby
RAutomation::UnknownWindowException: Window with locator {:index=>0, 
:title=>/^choose file( to upload)?|Elegir archivos para cargar$/i} doesn't 
exist or is not visible!
        from 
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rautomation-0.7.3/lib/rautomation/window.rb:226:in
 `rescue in wait_until_present'
        from 
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rautomation-0.7.3/lib/rautomation/window.rb:224:in
 `wait_until_present'
        from 
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rautomation-0.7.3/lib/rautomation/window.rb:214:in
 `text_field'
        from 
C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.3.0/lib/watir-classic/dialogs/file_field.rb:19:in
 `set_file_name'
        from 
C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.3.0/lib/watir-classic/dialogs/file_field.rb:7:in
 `set'
        from (irb):10
        from C:/Ruby193/bin/irb:12:in `<main>'

```

**Steps to Reproduce - Locally:**

1. Create a file called "file_field.htm", which contains a file field:

```html
<html>
        <body>
                <input type="file" id="myfile" />
        </body>
</html>
```

2. Create a file called "main.htm", which includes the above file in a frame:

```html
<html>
        <body>
                <iframe src="file_field.htm">
        </body>
</html>
```

3. Set the file field:

```ruby
require 'watir-classic'
browser = Watir::Browser.new
browser.goto('C:\Users\jko\Desktop\main.htm')
browser.frame.file_field.set 'c:\users\jko\desktop\file.txt'
```

--> Notice that the RAutomation::UnknownWindowException mentioned above occurs.

**Environment:**
- OS: Windows Vista
- Browser: IE9
- Ruby: 1.9.3p327
- Gems: watir (4.0.2), watir-classic (3.3.0), rautomation (0.7.3)

---
Reply to this email directly or view it on GitHub:
https://github.com/watir/watir-classic/issues/45
_______________________________________________
Wtr-development mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-development

Reply via email to