What if you use watir-webdriver to drive ie instead of watir? require 'watir-webdriver'
# Pass the browser you want to open @ie = Watir::Browser.new :ie #@ie = Watir::Browser.new :firefox #@ie = Watir::Browser.new :chrome On Thursday, July 12, 2012 8:33:34 AM UTC-4, Mahesh Shivankar wrote: > > Hello, > > I'm trying to automate import feature present in TestLink on my own > virtual machine using watir. > For this I've written a script > > require 'rubygems' > require 'watir' > URL = "http://192.168.9.12/testlink" > > class Testlink > > def gototestlink() > > @ie = Watir::Browser.new > @ie.maximize > @ie.goto(URL) > end > > > def gotologin() > > @ie.text_field(:id, "login").set("mahesh") > @ie.text_field(:name, "tl_password").set("mahesh123") > @ie.button(:value, "Login").click > > end > > def gototestspec() > > @ie.frame(:name, "titlebar").link(:text, /test > specification/i).click > @ie.frame(:name, "mainframe").frame(:name, "treeframe").div(:id, > 'extdd-1').span(:id, 'extdd-3').click > @ie.frame(:name, "mainframe").frame(:name, > "workframe").div(:class, 'workBack').fieldset(:class, > 'groupBtn').button(:value, "Import").click > @ie.frame(:name, "mainframe").frame(:name, > "workframe").div(:class, 'workBack').file_field(:name, > "uploadedFile").set("D:\\testsuites.xml") > @ie.frame(:name, "mainframe").frame(:name, > "workframe").div(:class, 'workBack').div(:class, 'groupBtn').button(:value, > "Upload file").click > end > > end > > a = Testlink.new > a.gototestlink() > a.gotologin() > a.gototestspec() > > The problem I'm facing is, on IE after setting the file field with desired > file which I want to upload and clicking on the Upload file button, the > file field which was set goes blank and the script fails to upload the > required file. I'm using Internet Explorer 9 ( version : 9.0.8112.16421) > > But when I approach to the same task using watir-webdriver and Mozilla > Firefox browser, the script successfully uploads the desired file. > > You are most welcome for any comments or help. > > Regards, > Mahesh > -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. [email protected] http://groups.google.com/group/watir-general [email protected]
