我正在查看一个带有覆盖的网页,其中包含选择文件/浏览等按钮 下面是该页面的一个片段
<form name = "form1" method = "post" action = "UploadPhoto.aspx?PhotoUploaderFor=1" id = "form1" enctype = "multipart/form-data">
<div>...</div>
<div class = "popup-form photoUploader">
<div class = "group data-row">
<label>...</label>
<input type ="file" name = "FileUpload1" id = "FileUpload1" class = "browse_file">
Watir 有 file_fields 可以处理我在测试站点 (www.tinypic.com) 上尝试过的文件上传,并且控件在那里工作正常
b.file_fields.exists?
将返回真
但是,在我使用上面的片段查看的页面上,
b.file_fields.exists?
返回假
我以为可能是形式的原因,所以我也尝试了
b.form(:name => "form1").file_fields.exists?
这也返回 false 如果我尝试直接访问按钮本身,这也返回 false
b.element(:xpath => "//input [@name = 'FileUpload1']").exists?
有人有想法么?
编辑
表单位于 iframe 内
<iframe id="Step1_Banner1_Popup_Photo_Photo_Iframe_PhotoUploader" class="photoUploaderFrame" scrolling="no" src="../MSReport3/UserControls/UploadPhoto.aspx?PhotoUploaderFor=1">
#document
<!DOCTYPE html PUBLIC "-//W3C//DTD CHTML 1.0 .....">
<html xmlns = "http://www.w3.org/1999/xhtml">
<head>...</head>
<body>
<code from above goes here>