html代码如下:
<li>
<form action="/en/pune/dsf/media/create" enctype="multipart/form-data" method="post">
<div style="margin: 0px; padding: 0px; display: inline;">
<input name="authenticity_token" type="hidden" value="DD9PUpCMWTGs66fHEZutO+9RFjcf68xH+T9DMXv1JnA="/>
</div>
<div class="media_upload_submit">
<span class="icon-camera"/>
<span class="al">Add photos</span>
</div>
<input class="media_image_file" data-track="photo_upload,spot_page,user" name="media[image]" type="file"/>
</form>
</li>
我试过使用
@browser.file_field(:xpath, "//input[@type='file' and @class='media_image_file']/").set "Complete file path name"
但我收到以下错误:
Failure: Unable to locate an element with the xpath expression //input[@type='file' and @class='media_image_file']/ because of the following error:
我尝试过使用许多不同的方法,但得到不同的错误。