Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/file/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如果上传文件是一个按钮标签,我如何用Ruby在cucumber中自动上传文件_Ruby_File_Upload_Cucumber_Watir - Fatal编程技术网

如果上传文件是一个按钮标签,我如何用Ruby在cucumber中自动上传文件

如果上传文件是一个按钮标签,我如何用Ruby在cucumber中自动上传文件,ruby,file,upload,cucumber,watir,Ruby,File,Upload,Cucumber,Watir,如果上传文件是一个按钮标签,我如何用ruby在cucumber中自动上传文件。我尝试使用脚本将类型转换为文件: @browser.execute_script("document.getElementById('elementid').setAttribute('type', 'file');") @browser.div(:class => "classname").file_field.set(file.path) 然后我得到一个错误: unable to locate eleme

如果上传文件是一个按钮标签,我如何用ruby在cucumber中自动上传文件。我尝试使用脚本将类型转换为文件:

@browser.execute_script("document.getElementById('elementid').setAttribute('type', 'file');") 
@browser.div(:class => "classname").file_field.set(file.path)
然后我得到一个错误:

unable to locate element, using `{:tag_name=>"input", :type=>"file"}`
错误发生在我的应用程序中的标记名为时

我该如何处理这个问题,有什么建议吗

HTML:


我们需要页面的html。这是页面html:选择文件subhashree patra:在添加html或代码时,最好编辑原始问题,以便所有信息都在一个位置并正确格式化。供参考。编辑原始问题以添加HTML。谢谢你的建议。这个按钮会触发一个常规的文件类型输入吗?也就是说,最终的结果仅仅是一个总体的文件类型?我认为您需要提供整个文件上传过程的工作示例。
<button type="button" id="pickfiles" class="btn btn-default" data-ng-class="{'disabled': noRuntime}" style="position: relative; z-index: 1;"> Select file </button>