Hello, Chuck!

Thank u for your post and sorry for my delayed response (and my bad 
english)!

Unfortunately, my web application isn't available outside the network of my 
company, otherwise I'd like more help :)

I considered all your suggestions, especially to talk to the developer and 
the PO before attempting any solution.

The PO said that this field is more protected, but isn't intended to make 
IMPOSSIBLE manipulate it programmatically ... just difficult it! All this 
because webApp I'm testing is a CMS used by journalists to publish news on 
our websites. They have MANY news, images, videos and diverse content to 
post every day, so they create "alternative ways" to publish that content 
more quickly. However, these "alternative ways" don't use the data entry 
validations and cause several errors in the application.

The developer said the file_field is hidden by CSS.

Knowing all this, the solution was as simple as you suggested. I just ran 
execute_script to set empty the "class" attribute of the form, then I 
manipulated the file_field.

The code looked like this:


@browser.execute_script("document.getElementById('file_upload').className = 
'';")
@browser.file_field(:name => "original").when_present.set (IMAGE_ROOT+image)


It works fine :)
Thanks A LOT! 

Karol

On Monday, April 15, 2013 12:07:40 PM UTC-3, Karoline Leite wrote:
>
> Hi !
>
> I'm trying to use an INPUT FILE, but I'm receiving error like "unable to 
> locate {:name=>"original", :tag_name=>"input", :type=>"file"} "
>
> My page has an DIV with an FORM, and the FORM has an INPUT FILE element. 
> The input file has an attribute "MULTIPLE"... 
>
> I'm trying:
>
> *@browser.div(:class, "ui-dialog ui-widget ui-widget-content 
> ui-corner-all ").form(:id, "file_upload").file_field(:name, 
> "original").when_present.set my_image*
> *
> *
> This way, I can't find the element... 
>
> I tried, just testing, the both codes and the STEP pass:
>
> *@browser.div(:class, "ui-dialog ui-widget ui-widget-content 
> ui-corner-all ").when_present.click*
> *
> *
> *@browser.div(:class, "ui-dialog ui-widget ui-widget-content 
> ui-corner-all ").form(:id, "file_upload").when_present.click*
> *
> *
> So, watir finds the DIV and the FORM, but can't find the input file... I'm 
> thinking the problem is the attribute *multiple *
> *
> *
>
> How do I set this input file ?
>
>
> The page code:
>
> <div style="display: block; z-index: 1002; outline: 0px; height: auto; 
>>> width: 500px; top: 144px; left: 426px;" class="ui-dialog ui-widget 
>>> ui-widget-content ui-corner-all " tabindex="-1" role="dialog" 
>>> aria-labelledby="ui-dialog-title-add_media_dialog"><div 
>>> class="ui-dialog-titlebar ui-widget-header ui-corner-all 
>>> ui-helper-clearfix"><span class="ui-dialog-title" 
>>> id="ui-dialog-title-add_media_dialog"><span class="title">Adicionar 
>>> imagens</span></span><a href="#" class="ui-dialog-titlebar-close 
>>> ui-corner-all" role="button"><span class="ui-icon 
>>> ui-icon-closethick">close</span></a></div><div id="add_media_dialog" 
>>> style="display: block; width: auto; min-height: 114px; height: auto;" 
>>> class="ui-dialog-content ui-widget-content">
>>
>> <div class="main upload-form clearfix" style="">
>>
>>                               <form action="/data_entry/imagens/upload" 
>>> enctype="multipart/form-data" id="file_upload" method="post" 
>>> class="file_upload"><div style="margin:0;padding:0;display:inline"><input 
>>> name="authenticity_token" type="hidden" 
>>> value="jyzTEwkkJt3MjDn7O5IS+EY1gmuayRiBpDtZXumS4TA="></div>
>>
>> *<input multiple="multiple" name="original" type="file">*
>>
>> <div class="dropzone">Arraste seus arquivos de imagem nesta área ou 
>>> clique para escolher os arquivos</div>
>>
>>                               </form>
>>
>> <div id="files">
>>
>> <div class="uploaded"></div>
>>
>> <table class="to-upload">
>>
>> <tbody></tbody>
>>
>> </table>
>>
>> </div>
>>
>> </div>
>>
>> <div class="actions" style="">
>>
>> <button class="button default cancel" id="btn_file_upload_cancel">
>>
>> <span class="ico"></span>
>>
>> Cancelar
>>
>> </button>
>>
>> <button class="button default play file_upload_start" 
>>> id="btn_file_upload_start">
>>
>> <span class="ico"></span>
>>
>> <span begin="Iniciar" class="text" continue="Continuar" pause="Pausar" 
>>> pausing="Pausando...">Iniciar</span>
>>
>> </button>
>>
>> <button class="button default ok file_upload_next" 
>>> id="btn_file_upload_done">
>>
>> <span class="ico"></span>
>>
>> Pronto
>>
>> </button>
>>
>> </div>
>>
>> </div></div>
>>
>>
>
> Thanks in advance!
> Karol  
>

-- 
-- 
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/groups/opt_out.


Reply via email to