ruby - Automating system level print dialog box -
i writing script automate save process webpage.
basically there website on there button called preview
. steps be:
- click on preview button,on pressing webpage appears data , @ bottom there print button.
- now click on print button, after print dialog box appears in mozilla firefox.
- after select pdf name(ie drop down in print dialog box) , click on ok button.
- now save dialog box appears,where need provide path save file , name of file.
code
require 'selenium-webdriver' require 'win32ole' require "au3" require 'rautomation' driver = selenium::webdriver.for:firefox driver.manage().window().maximize(); driver.navigate.to 'c:\users\js830363\documents\userdata\goi\new_sahi\ruby_final\demo2.html' wait = selenium::webdriver::wait.new(:timeout =>180) wait.until {driver.find_element(:id,'button1').click} #id of print button click //till here work fine.i print dialog box in firefox after have tried autoit: #wait window exist autoitx3::window.wait("print") #the start of title enough find window = autoitx3::window.new("print")#get reference window.activate #bring front autoitx3::window.controlclick("print", "", "1057")#id of ok , cancel button window.controlclick("print", "", "1058") rautomation: win = rautomation::window.new :title => /opening rautomation/, :adapter => :ms_uia win.send_keys :enter file_dialog = rautomation::window.new :title => /enter name of file/ file_dialog.button(:value => "&save").click
error
c:\users\js830363\desktop>ruby test1.rb c:/ruby200/lib/ruby/2.0.0/net/protocol.rb:158:in `rescue in rbuf_fill': net::rea dtimeout (net::readtimeout) c:/ruby200/lib/ruby/2.0.0/net/protocol.rb:152:in `rbuf_fill' c:/ruby200/lib/ruby/2.0.0/net/protocol.rb:134:in `readuntil' c:/ruby200/lib/ruby/2.0.0/net/protocol.rb:144:in `readline' c:/ruby200/lib/ruby/2.0.0/net/http/response.rb:39:in `read_status_line'
i using ruby 2.0.0 , selenium webdriver autorit have tried using reautomation unable click print button.
Comments
Post a Comment