ruby - Testing upload watir and rspec -


i trying test upload pictures/document on web pages using watir/watir-webdriver, tried not work.

for example, uploading pictures on imgur:

require 'watir' require 'watir-webdriver' require 'rspec'  describe "upload test"    before(:all)        @browser = watir::browser.new :firefox       @browser.goto("https://imgur.com/")   end    context "upload test"     "can upload picture"       @browser.link(:text, "upload images").click       @browser.file_field(:name, "img_path").set("img_path")       @browser.button(:value,"save").click     end   end    after(:all)     @browser.close unless debugging?   end  end 

there error.

failures:    1) upload test upload test can upload picture      failure/error: @browser.link(:text, "upload images").click       watir::exception::unknownobjectexception:        unable locate element, using {:text=>"upload images", :tag_name=>"a"}      # /var/lib/gems/1.9.1/gems/watir-webdriver-0.9.1/lib/watir-webdriver/elements/element.rb:536:in `assert_element_found'      # /var/lib/gems/1.9.1/gems/watir-webdriver-0.9.1/lib/watir-webdriver/elements/element.rb:508:in `assert_exists'      # /var/lib/gems/1.9.1/gems/watir-webdriver-0.9.1/lib/watir-webdriver/elements/element.rb:114:in `click'      # ./proba.rb:14:in `block (3 levels) in <top (required)>'  finished in 11.47 seconds (files took 0.19261 seconds load) 1 example, 1 failure  failed examples:  rspec ./proba.rb:13 # upload test upload test can upload picture 

i have tried upload on other sites, not. can show me correct way upload document using watir? think there trick using "flash" buttons, not sure?

that error saying doesn't see link text "upload images" on page, has nothing file uploading. being said, if text field visible, should doing: @browser.file_field(name: 'img_path').set @file_path


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -