Re: [wtr-general] Re: Link with javascript
Yes, but didn't work as well.. but I tried this and it worked. :) @engine.link(:href=>'javascript:fnLogin()').send_keys :enter On Thu, Sep 15, 2011 at 9:38 PM, Super Kevy wrote: > Did you try the image click? > > On Sep 14, 8:21 am, Anne Kristine King wrote: > > Hi Everyone, > > > > Need help in figuring out how to click the link below with the given html > : > > > > vAlign="bottom" > > width="120" align="right">Customer ID: > > > > > > maxLength="32" > > value="" type="text"> > > > > > > > > > > > > vAlign="bottom" > > align="right">Password: > > > >> maxLength="32" value="" type="password"> > > > > > > > > > onmouseover="MM_swapImage('Image3','','/Images/login_over-pages.gif',1)" > > onmouseout="MM_swapImgRestore()" src="/Images/login-pages.gif" > width="120" > > height="19"> > > > > > > > > I'm using watir-webdriver, and I've tried it this way, but it's not > > successful.. > > > > irb(main):045:0> @engine.link(:href, > > /javascript:fnLogin/).fire_event('onmousedown') > > => true > > irb(main):046:0> @engine.link(:href, > > /javascript:fnLogin/).fire_event('onclick') > > => true > > irb(main):047:0> @engine.link(:href, /javascript:fnLogin/).click > > Selenium::WebDriver::Error::ElementNotDisplayedError: Cannot click on > > element > > from > > > C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.5.0/lib/selenium/webdriver/remote/response.rb:45:in > > `assert_ok' > > from > > > C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.5.0/lib/selenium/webdriver/remote/response.rb:15:in > > `initialize' > > from > > > C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.5.0/lib/selenium/webdriver/remote/http/common.rb:53:in > > `new' > > from > > > C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.5.0/lib/selenium/webdriver/remote/http/common.rb:53:in > > `create_response' > > from > > > C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.5.0/lib/selenium/webdriver/remote/http/default.rb:56:in > > `request' > > from > > > C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.5.0/lib/selenium/webdriver/remote/http/common.rb:34:in > > `call' > > from > > > C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.5.0/lib/selenium/webdriver/remote/bridge.rb:410:in > > `raw_execute' > > from > > > C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.5.0/lib/selenium/webdriver/remote/bridge.rb:388:in > > `execute' > > from > > > C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.5.0/lib/selenium/webdriver/remote/bridge.rb:236:in > > `clickElement' > > from > > > C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.5.0/lib/selenium/webdriver/common/element.rb:34:in > > `click' > > from > > > C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.3.3/lib/watir-webdriver/elements/element.rb:67:in > > `click' > > from (irb):47 > > from C:/Ruby192/bin/irb:12:in `' > > > > Hope somebody can help me with this.. > > Thanks Guys! :) > > -- > Before posting, please read http://watir.com/support. In short: search > before you ask, be nice. > > watir-general@googlegroups.com > http://groups.google.com/group/watir-general > watir-general+unsubscr...@googlegroups.com > -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Can't access HTML in modal dialog using Ruby 1.9.2 and Watir 2.0.2
The code below works fine with Win7, IE8, Ruby 1.8.6 and Watir 1.6.2 for accessing an 'Internet Explorer_TridentDlgFrame' modal dialog. This code gives the error below when I upgrade to Ruby 1.9.2 and Watir 2.0.2. It does not appear to be a timing issue because I have tried sleeps and Watir::Wait.until without success. I can find the dialog but I cannot access the HTML code. I can also find the dialog using RAutomation directly but I have the same problem. I can't see the HTML to access the controls on the modal dialog. The modal dialog has a text_field a select_list and 2 buttons all within a frame. Is there another tool I should be using with these newer versions of Ruby and Watir to access the HTML in a modal dialog? Thank you for your help. * require 'watir' ie = Watir::IE.attach(:title, /my title/i) btnOK = ie.button(:id, 'OK').click_no_wait() # this opens the modal dialog iemod = nil 50.times do begin iemod = ie.modal_dialog # this does find the dialog puts "** dialog found **" break rescue puts "** dialog not found **" sleep(1) end end sleep(20) frame = iemod.frame(:name, 'Frame') modSelectList = frame.select_list(:name, 'Select_List') puts modSelectList.exists? C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/lib/ watir/modal_dialog.rb:32:in `locate': undefined method `connect_unknown' for WIN32OLE:Class (NoMethodError) from C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ lib/watir/modal_dialog.rb:36:in `document' from C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ lib/watir/locator.rb:7:in `document' from C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ lib/watir/locator.rb:147:in `each_element' from C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ lib/watir/locator.rb:159:in `block in each' from C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ lib/watir/locator.rb:158:in `each' from C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ lib/watir/locator.rb:158:in `each' from C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ lib/watir/locator.rb:173:in `locate' from C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ lib/watir/frame.rb:10:in `locate' from C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ lib/watir/element.rb:75:in `assert_exists' from C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ lib/watir/frame.rb:35:in `document' from C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ lib/watir/frame.rb:24:in `__ole_inner_elements' from C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ lib/watir/locator.rb:200:in `each_element' from C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ lib/watir/locator.rb:220:in `each' from C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ lib/watir/locator.rb:213:in `locate' from C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ lib/watir/input_elements.rb:6:in `locate' from C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ lib/watir/element.rb:391:in `exists?' from watir202test.rb:39:in `' ** dialog found ** -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Re: Can't access HTML in modal dialog using Ruby 1.9.2 and Watir 2.0.2
Does watir 2.x support ruby 1.9.x? http://watir.com/installation/ still recommends 1.8.6 or 1.8.7 (although the documentation might be slightly out of date). orde On Sep 16, 7:48 am, George Wiley wrote: > The code below works fine with Win7, IE8, Ruby 1.8.6 and Watir 1.6.2 > for accessing an 'Internet Explorer_TridentDlgFrame' modal dialog. > This code gives the error below when I upgrade to Ruby 1.9.2 and Watir > 2.0.2. It does not appear to be a timing issue because I have tried > sleeps and Watir::Wait.until without success. > > I can find the dialog but I cannot access the HTML code. I can also > find the dialog using RAutomation directly but I have the same > problem. I can't see the HTML to access the controls on the modal > dialog. > > The modal dialog has a text_field a select_list and 2 buttons all > within a frame. > > Is there another tool I should be using with these newer versions of > Ruby and Watir to access the HTML in a modal dialog? > > Thank you for your help. > * > require 'watir' > > ie = Watir::IE.attach(:title, /my title/i) > > btnOK = ie.button(:id, 'OK').click_no_wait() # this opens the > modal dialog > > iemod = nil > > 50.times do > begin > iemod = ie.modal_dialog # this does find the dialog > puts "** dialog found **" > break > rescue > puts "** dialog not found **" > sleep(1) > end > end > > sleep(20) > frame = iemod.frame(:name, 'Frame') > modSelectList = frame.select_list(:name, 'Select_List') > puts modSelectList.exists? > > C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/lib/ > watir/modal_dialog.rb:32:in `locate': undefined method > `connect_unknown' for WIN32OLE:Class (NoMethodError) > from C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ > lib/watir/modal_dialog.rb:36:in `document' > from C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ > lib/watir/locator.rb:7:in `document' > from C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ > lib/watir/locator.rb:147:in `each_element' > from C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ > lib/watir/locator.rb:159:in `block in each' > from C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ > lib/watir/locator.rb:158:in `each' > from C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ > lib/watir/locator.rb:158:in `each' > from C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ > lib/watir/locator.rb:173:in `locate' > from C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ > lib/watir/frame.rb:10:in `locate' > from C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ > lib/watir/element.rb:75:in `assert_exists' > from C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ > lib/watir/frame.rb:35:in `document' > from C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ > lib/watir/frame.rb:24:in `__ole_inner_elements' > from C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ > lib/watir/locator.rb:200:in `each_element' > from C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ > lib/watir/locator.rb:220:in `each' > from C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ > lib/watir/locator.rb:213:in `locate' > from C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ > lib/watir/input_elements.rb:6:in `locate' > from C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ > lib/watir/element.rb:391:in `exists?' > from watir202test.rb:39:in `' > ** dialog found ** -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Re: Can't access HTML in modal dialog using Ruby 1.9.2 and Watir 2.0.2
I read in this group that Ruby 1.9.2 and Watir 2.x was ready to test. I thought I would run my scripts through and see what I get. For the most part with some changes I have been able to run many scripts successfully. This happens to be a problem I can't figure out. On Sep 16, 12:47 pm, orde wrote: > Does watir 2.x support ruby 1.9.x? http://watir.com/installation/ > still recommends 1.8.6 or 1.8.7 (although the documentation might be > slightly out of date). > > orde > > On Sep 16, 7:48 am, George Wiley wrote: > > > > > The code below works fine with Win7, IE8, Ruby 1.8.6 and Watir 1.6.2 > > for accessing an 'Internet Explorer_TridentDlgFrame' modal dialog. > > This code gives the error below when I upgrade to Ruby 1.9.2 and Watir > > 2.0.2. It does not appear to be a timing issue because I have tried > > sleeps and Watir::Wait.until without success. > > > I can find the dialog but I cannot access the HTML code. I can also > > find the dialog using RAutomation directly but I have the same > > problem. I can't see the HTML to access the controls on the modal > > dialog. > > > The modal dialog has a text_field a select_list and 2 buttons all > > within a frame. > > > Is there another tool I should be using with these newer versions of > > Ruby and Watir to access the HTML in a modal dialog? > > > Thank you for your help. > > * > > require 'watir' > > > ie = Watir::IE.attach(:title, /my title/i) > > > btnOK = ie.button(:id, 'OK').click_no_wait() # this opens the > > modal dialog > > > iemod = nil > > > 50.times do > > begin > > iemod = ie.modal_dialog # this does find the dialog > > puts "** dialog found **" > > break > > rescue > > puts "** dialog not found **" > > sleep(1) > > end > > end > > > sleep(20) > > frame = iemod.frame(:name, 'Frame') > > modSelectList = frame.select_list(:name, 'Select_List') > > puts modSelectList.exists? > > > C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/lib/ > > watir/modal_dialog.rb:32:in `locate': undefined method > > `connect_unknown' for WIN32OLE:Class (NoMethodError) > > from C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ > > lib/watir/modal_dialog.rb:36:in `document' > > from C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ > > lib/watir/locator.rb:7:in `document' > > from C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ > > lib/watir/locator.rb:147:in `each_element' > > from C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ > > lib/watir/locator.rb:159:in `block in each' > > from C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ > > lib/watir/locator.rb:158:in `each' > > from C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ > > lib/watir/locator.rb:158:in `each' > > from C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ > > lib/watir/locator.rb:173:in `locate' > > from C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ > > lib/watir/frame.rb:10:in `locate' > > from C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ > > lib/watir/element.rb:75:in `assert_exists' > > from C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ > > lib/watir/frame.rb:35:in `document' > > from C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ > > lib/watir/frame.rb:24:in `__ole_inner_elements' > > from C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ > > lib/watir/locator.rb:200:in `each_element' > > from C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ > > lib/watir/locator.rb:220:in `each' > > from C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ > > lib/watir/locator.rb:213:in `locate' > > from C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ > > lib/watir/input_elements.rb:6:in `locate' > > from C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ > > lib/watir/element.rb:391:in `exists?' > > from watir202test.rb:39:in `' > > ** dialog found **- Hide quoted text - > > - Show quoted text - -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Re: Watir-Webdriver IE issue (UnexpectedJavascriptError: Unable to find element with xpath)
hey jw, I am running this in irb... sleep/wait shouldn't be an issue there, right? -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Re: Can't access HTML in modal dialog using Ruby 1.9.2 and Watir 2.0.2
Ahhh...I didn't realize that Ruby 1.9.2 + Watir 2.x was ready for testing. I'll have to upgrade a VM and take a look as well. Sorry for getting off topic and not providing a solution to your issue ;) orde On Sep 16, 11:03 am, George Wiley wrote: > I read in this group that Ruby 1.9.2 and Watir 2.x was ready to test. > I thought I would run my scripts through and see what I get. For the > most part with some changes I have been able to run many scripts > successfully. This happens to be a problem I can't figure out. > > On Sep 16, 12:47 pm, orde wrote: > > > > > > > > > Does watir 2.x support ruby 1.9.x? http://watir.com/installation/ > > still recommends 1.8.6 or 1.8.7 (although the documentation might be > > slightly out of date). > > > orde > > > On Sep 16, 7:48 am, George Wiley wrote: > > > > The code below works fine with Win7, IE8, Ruby 1.8.6 and Watir 1.6.2 > > > for accessing an 'Internet Explorer_TridentDlgFrame' modal dialog. > > > This code gives the error below when I upgrade to Ruby 1.9.2 and Watir > > > 2.0.2. It does not appear to be a timing issue because I have tried > > > sleeps and Watir::Wait.until without success. > > > > I can find the dialog but I cannot access the HTML code. I can also > > > find the dialog using RAutomation directly but I have the same > > > problem. I can't see the HTML to access the controls on the modal > > > dialog. > > > > The modal dialog has a text_field a select_list and 2 buttons all > > > within a frame. > > > > Is there another tool I should be using with these newer versions of > > > Ruby and Watir to access the HTML in a modal dialog? > > > > Thank you for your help. > > > * > > > require 'watir' > > > > ie = Watir::IE.attach(:title, /my title/i) > > > > btnOK = ie.button(:id, 'OK').click_no_wait() # this opens the > > > modal dialog > > > > iemod = nil > > > > 50.times do > > > begin > > > iemod = ie.modal_dialog # this does find the dialog > > > puts "** dialog found **" > > > break > > > rescue > > > puts "** dialog not found **" > > > sleep(1) > > > end > > > end > > > > sleep(20) > > > frame = iemod.frame(:name, 'Frame') > > > modSelectList = frame.select_list(:name, 'Select_List') > > > puts modSelectList.exists? > > > > C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/lib/ > > > watir/modal_dialog.rb:32:in `locate': undefined method > > > `connect_unknown' for WIN32OLE:Class (NoMethodError) > > > from > > > C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ > > > lib/watir/modal_dialog.rb:36:in `document' > > > from > > > C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ > > > lib/watir/locator.rb:7:in `document' > > > from > > > C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ > > > lib/watir/locator.rb:147:in `each_element' > > > from > > > C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ > > > lib/watir/locator.rb:159:in `block in each' > > > from > > > C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ > > > lib/watir/locator.rb:158:in `each' > > > from > > > C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ > > > lib/watir/locator.rb:158:in `each' > > > from > > > C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ > > > lib/watir/locator.rb:173:in `locate' > > > from > > > C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ > > > lib/watir/frame.rb:10:in `locate' > > > from > > > C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ > > > lib/watir/element.rb:75:in `assert_exists' > > > from > > > C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ > > > lib/watir/frame.rb:35:in `document' > > > from > > > C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ > > > lib/watir/frame.rb:24:in `__ole_inner_elements' > > > from > > > C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ > > > lib/watir/locator.rb:200:in `each_element' > > > from > > > C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ > > > lib/watir/locator.rb:220:in `each' > > > from > > > C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ > > > lib/watir/locator.rb:213:in `locate' > > > from > > > C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ > > > lib/watir/input_elements.rb:6:in `locate' > > > from > > > C:/programs/Ruby-192-p290/lib/ruby/gems/1.9.1/gems/watir-2.0.2/ > > > lib/watir/element.rb:391:in `exists?' > > > from watir202test.rb:39:in `' > > > ** dialog found **- Hide quoted text - > > > - Show quoted text - -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsub
[wtr-general] Re: Watir-Webdriver IE issue (UnexpectedJavascriptError: Unable to find element with xpath)
true. I just read the bottom of your post that said it was working for FF. that sounds like a weird one. only thing i could suggest would be to try to access it a different way (using id, text, anything else) or do something like lists=b.select_lists and iterate through the lists and see what's there. On Sep 16, 1:19 pm, Mike wrote: > hey jw, > I am running this in irb... sleep/wait shouldn't be an issue there, right? -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] firefox (on windows) DL path in browser prefs has issues
ruby 187 selenium-webdriver (2.6.0) watir (2.0.1) watir-webdriver (0.3.3) It looks like FF (3.6.6) has some issues with the DL path setting: browserProfile['browser.download.dir'] = "C:\my\new\dir" 1) it seems the string you pass must use backslashes and must contain the drive letter 2) this example path will not work because webdriver first makes a file called user.js which has a line like: user_pref("browser.download.dir", "C:\my\new\dir"); but when FF starts up it creates prefs.js which will have a line like: user_pref("browser.download.dir", "C:\\my\new\\dir"); where the \ before the 'n' is lost. It does the same thing for '\r' so I put in a hack in my classExtensions file that looks like: module Selenium module WebDriver module Firefox class Profile def write_prefs(prefs, path) File.open(path, "w") { |file| prefs.each do |key, value| if (key['download'] and value.kind_of?(String)) value.gsub!(/\\n/, '\\n') value.gsub!(/\\r/, '\\r') end file.puts %{user_pref("#{key}", #{value});} end } puts path end end end end end -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com