1
我想上傳一張watir和phantomjs的圖片,但它是失敗的。上傳文件與watir和phantomjs上OSX
HTML代碼:
<div class="qq-uploader">
<div class="qq-upload-drop-area" style="display: none;">
<span>Drop files here to upload</span>
</div>
<div class="qq-upload-button" style="position: relative; overflow: hidden; direction: ltr;">
<div>Click or Drop for upload images</div>
<input multiple="multiple" type="file" name="qqfile">
</div>
<span class="qq-drop-processing">
<span>Processing dropped files...</span>
<span class="qq-drop-processing-spinner"></span>
</span>
<ul class="qq-upload-list"></ul>
</div>
</div>
我試圖
require 'phantomjs'
require 'watir'
require 'watir-webdriver'
Selenium::WebDriver::PhantomJS.path = '/phantomjs/bin/phantomjs'
b = Watir::Browser.new(:phantomjs)
b.goto("http://website.com")
b.text_field(:name => /title/).set 'My title'
b.div(:id => "restricted-fine-uploader").fire_event :click
file = "/Users/Tom/Pictures/image.jpg"
b.file_field.set(file)
和
b.div(:id => "restricted-fine-uploader").fire_event :click
file = "/Users/Tom/Pictures/image.jpg"
b.file_field(:name => "qqfile").set(file)
但它不工作,我有一個網:: ReadTimeout錯誤。我錯在哪裏? THX
thx,我會用':chrome' – Rubyx