Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Ruby
Posted by: Mandisi Makwakwa
Added: May 23, 2018 10:59 AM
Views: 24
Tags: no tags
  1. require 'selenium-webdriver'
  2.  
  3. $driver = Selenium::WebDriver.for :chrome
  4. $driver.get 'https://www.script-tutorials.com/demos/199/index.html'
  5.  
  6. element = $driver.find_element(:xpath=>'//*[@id="image_file"]')
  7. puts "Element Value : #{element.nil?}"
  8. unless element.nil?
  9.   puts "Into the unless"
  10.   element.send_keys('/home/qualica/codeDome/work/flexifin-vbs/qualitygate/resources/upload_file')
  11.   puts "The keys have been sent."
  12.   $driver.find_element(:xpath=>'//*[@id="upload_form"]/div[2]/input').click
  13.   puts "Upload Complete"
  14. end
  15. sleep 1000