[
http://jira.openqa.org/browse/WTR-340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=20370#action_20370
]
Zach commented on WTR-340:
--------------------------
I have had issues with the save image feature not inputting the path that I
gave the method call. After digging I found this to be my issue which I think
address this bug. In the image.rb -> fill_save_image_dialog(path) method, there
is the command variable which creates a ruby script to execute in a new rubyw
instance.
The issue that I found in my environment was that it was missing the "require
'rubygems';" line when building the command. This made the script fail because
it couldn't find the rautomation gem. I added the require line and it fixed the
issue I was having.
Original Code from watir-2.0.2 image.rb:
def fill_save_image_dialog(path)
command = "require 'rautomation';" <<
"window=::RAutomation::Window.new(:title => 'Save Picture');" <<
"window.text_field(:class => 'Edit', :index =>
0).set('#{path}');" <<
"window.button(:value => '&Save').click"
Thread.new do
system("ruby -e \"#{command}\"")
end
end
Modified code of the same method that fixed the issue:
def fill_save_image_dialog(path)
command = "require 'rubygems';" <<
"require 'rautomation';" <<
"window=::RAutomation::Window.new(:title => 'Save Picture');" <<
"window.text_field(:class => 'Edit', :index =>
0).set('#{path}');" <<
"window.button(:value => '&Save').click"
Thread.new do
system("ruby -e \"#{command}\"")
end
end
> watirspec: Image#save and FileField#set should fix path for windows
> -------------------------------------------------------------------
>
> Key: WTR-340
> URL: http://jira.openqa.org/browse/WTR-340
> Project: Watir
> Issue Type: Sub-task
> Components: Save File
> Affects Versions: 1.6.2
> Environment: Watir::IE on WinXP
> Reporter: Jari Bakken
> Fix For: Soon
>
>
> 61)
> 'Image#save saves an image to file' FAILED
> expected true, got false
> ./spec/watirspec/image_spec.rb:208:
> 32)
> 'FileField#set is able to set a file path in the field and click the upload
> button and fire the onchange event' FAILED
> expected: "Z:/git/watir/spec/watirspec/filefield_spec.rb",
> got: "" (using ==)
> ./spec/watirspec/filefield_spec.rb:114:
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.openqa.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
_______________________________________________
Wtr-development mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-development