Hello!
Curious if anyone else has run into this issue. We are trying to use watir
to set a path using file_field:
browser.file_field.set("C:\\test\\profile-empty.gif")
It works one some of our testing environments, but gets hung up on others.
Here is the error, which makes sense because the choose window never opens:
RAutomation::UnknownWindowException: Window with locator {:index=>0, :title
=>/^(?-mix:(?i-mx:choose file( to upload)?)|Elegir\ archivos\ para\ cargar|
Datei\ zum\ Hochladen)$/i} doesn't exist or is not visible!
gems/rautomation-0.15.0/lib/rautomation/window.rb:226:in `rescue in
wait_until_present'
gems/rautomation-0.15.0/lib/rautomation/window.rb:224:in
`wait_until_present'
gems/rautomation-0.15.0/lib/rautomation/window.rb:214:in `text_field'
gems/watir-classic-4.0.1/lib/watir-classic/dialogs/file_field.rb:48:in
`set_file_name'
gems/watir-classic-4.0.1/lib/watir-classic/dialogs/file_field.rb:34:in
`set'
watir/tests/workflow/CgiAttributes.rb:2525:in `testTypeFile'
Was able to reproduce manually, and it appears that click_no_wait in the
code below is not doing anything when it fails. It does not bring up the
file selection dialog.
def set(file_path)
assert_file_exists(file_path)
assert_exists
click_no_wait
set_file_name file_path.gsub(File::SEPARATOR, File::ALT_SEPARATOR)
open_button.click
Wait.until(5) {value.include?(File.basename(file_path))}
end
Manually clicking the button while the browser is waiting for the choose a
file dialog opens it and then it is populated immediately. I tried a few
other things like what is on this page
(http://stackoverflow.com/questions/13918184/watir-help-click-no-wait-and-execute-script-not-working-as-expected),
but the click freezes execution so the timeout never occurs:
Timeout::timeout(1) { @browser.button(:value, 'Submit').click }
Any suggestions or known patches? The only search results I found were from
2012 and it was an issue with an iFrame. Here there is no iFrame, just the
root page. The HTML is basic, and watir finds the element and can interact
in other ways with it. RAutomation seems to be doing the right thing once
the file dialog opens... but it doesn't open in some cases.
Thanks in advance,
Michael
--
--
Before posting, please read http://watir.com/support. In short: search before
you ask, be nice.
[email protected]
http://groups.google.com/group/watir-general
[email protected]
---
You received this message because you are subscribed to the Google Groups
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.