Re: [wtr-general] Accessing an unordered list
Hi Anne, Have you tried browser.li(:id= abc/123,:index=1).click ? rgds Keith On Wed, Apr 6, 2011 at 9:49 PM, Anne annemordk...@gmail.com wrote: I've been doing automation for a while but am new to Ruby/Watir. I'm trying to access the first item in an unordered list and everything I try returns an Argument Error (wrong number of arguments (2 for 0)). I've been hitting my head against a wall for a day now and just can't seem to get it. Can you please help? the html looks like this: div id=searchResults div id=priorities div id=resultList ul li a id=abc/123 classsearchResult searchResultPreviewed href=/mystuff/my-topic My Topic Title /a /li +li +li /ul I'm trying to click on the first li item (which is one of many). I've tried: browser.lis(:id, abc/123).click browser.lis(:xpath, //a[id='abc/123']/).click browser.lis(:text, My Topic Title).click I also tried all these with .select instead of .click each time I've gotten ArgumentError: wrong number of arguments (2 for 0) I know I'm missing something basic. Can you point me in the right direction? Thanks! Anne -- 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
Re: [wtr-general] Re: help-please: cucumber-watir tutorial
Irfan, Have a look at these, http://khughes88.wordpress.com/tag/cucumber/ http://khughes88.wordpress.com/tag/webdriver/ rgds Keith On Tue, Dec 14, 2010 at 3:04 AM, Dave McNulla mcnu...@gmail.com wrote: that's on my wish list. i'll probably buy it next. dave On Dec 13, 10:39 am, Chuck van der Linden sqa...@gmail.com wrote: http://www.pragprog.com/titles/achbd/the-rspec-book buy and read On Dec 12, 4:39 pm, Basim Baassiri ba...@baassiri.ca wrote: Have you read any information herehttp://www.cuke4ninja.com/ On Sun, Dec 12, 2010 at 12:40 PM, Irfan Ahmed irfan...@gmail.com wrote: Hi, Anybody here who can provide some tutorial links/books on Cucumber- Watir-Wevdriver? I need this help very urgently. Please help me. -- Before posting, please readhttp://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- 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.comhttp://groups.google.com/group/watir-general%0awatir-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
Re: [wtr-general] execute the ruby script remotely
Hi Arihan, Here's something fairly simple that works. gem install sinatra run this script on the target machine require 'rubygems' require 'sinatra' get '/ruby' do `ruby rubyscript.rb` puts I'm runnning your script now end Now, on the other machine either browse to http://ipaddress:4567/rubyhttp://%3cipaddress%3e:4567/ruby or run this: require 'net/http' http = Net::HTTP.new('localhost', 4567) path = '/ruby' response=http.get(path, nil) Keith On Wed, Oct 20, 2010 at 7:22 PM, arihan sinha arihan.si...@gmail.comwrote: Hi All, I am trying to do something like ruby is installed in system1, and system2. I am at system1. I want to connect to system2, then invoke ruby and execute a ruby script. say I've a sample script in system2 as sample.rb. I want to run that from system1. Please let me know how I would do that. Regards Arihan -- 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.comwatir-general%2bunsubscr...@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
Re: [wtr-general] Does anyone know if ci_reporter gem works with ruby 1.9?
Hi, In the first example, did it create a test/reports folder in the folder where your test resides? Keith On Tue, Oct 19, 2010 at 12:43 PM, paneer_tikka neeraja...@gmail.com wrote: I couldn't get it to work. The following code produces no xml --- require 'test/unit' require 'ci/reporter/rake/test_unit_loader' class TC_MyTest Test::Unit::TestCase def test_fail assert(false, 'Assertion was false.') end def test_succeed assert(true, 'Assertion was true.') end end -- And changing the require to 'ci/reporter/rake/test_unit' produces the error pasted below: -- c:/ruby192/lib/ruby/gems/1.9.1/gems/ci_reporter-1.6.3/lib/ci/reporter/ rake/test_unit.rb:7:in `top (required)': undefin ed method `namespace' for main:Object (NoMethodError) from internal:lib/rubygems/custom_require:33:in `require' from internal:lib/rubygems/custom_require:33:in `rescue in require' from internal:lib/rubygems/custom_require:29:in `require' from ci_test.rb:2:in `main' I have ruby 1.9.2 on windows with test-unit (1.2.3) and ci_reporter (1.6.3) installed. -- 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
Re: [wtr-general] using verify method
Kartheek This should work, require 'watir/testcase' require 'watir-webdriver' class Test_google_ff Watir::TestCase def setup @Browser = Watir::Browser.new(:firefox) @Browser.goto http://www.google.com; end def test_google1 verify(@Browser.button(:name,blah).exist?,Dude where's my button) end def teardown @Browser.close end end rgds Keith On Tue, Sep 14, 2010 at 7:18 AM, chunchu kartheek chunchukarth...@gmail.com wrote: Hi , Can anyone help me how to use verify method . I want to verify whether a link exists or not in a page. Want to display error message if does not exist. Thanks in advance Regards, Kartheek -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. You received this message because you are subscribed to http://groups.google.com/group/watir-general To post: watir-general@googlegroups.com To unsubscribe: watir-general+unsubscr...@googlegroups.comwatir-general%2bunsubscr...@googlegroups.com -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. You received this message because you are subscribed to http://groups.google.com/group/watir-general To post: watir-general@googlegroups.com To unsubscribe: watir-general+unsubscr...@googlegroups.com
Re: [wtr-general] Close All browser function
Hi Usman looking through the code in browser.rb all I can see is 'close', no 'close_all' or 'quit' Regards Keith On Tue, Sep 14, 2010 at 10:28 AM, Usman Hussain usmanhhuss...@gmail.comwrote: Hi Guys, Im using Watir-WebDriver and firefox In my tests at the end I want to close all instances of the browsers (which is 3 browser windows in total) In my env.rb file i have: After do @browser.close_all end BUT it does not close all browser windows. I get the following error message: undefined method `close_all' for #Watir::Browser:0x3dcb1b0 (NoMethodError) Is there anyone who has had a similar problem like this before? Thanks in advance, Usman Hussain -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. You received this message because you are subscribed to http://groups.google.com/group/watir-general To post: watir-general@googlegroups.com To unsubscribe: watir-general+unsubscr...@googlegroups.comwatir-general%2bunsubscr...@googlegroups.com -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. You received this message because you are subscribed to http://groups.google.com/group/watir-general To post: watir-general@googlegroups.com To unsubscribe: watir-general+unsubscr...@googlegroups.com
Re: [wtr-general] Close All browser function
Hi Usman, If you really want to shut down all browers you could try this: require 'sys-proctable' Sys::ProcTable.ps.each{|ps| if ps.name.downcase==firefox.exe Process.kill('KILL',ps.pid) end } Keith On Tue, Sep 14, 2010 at 10:28 AM, Usman Hussain usmanhhuss...@gmail.comwrote: Hi Guys, Im using Watir-WebDriver and firefox In my tests at the end I want to close all instances of the browsers (which is 3 browser windows in total) In my env.rb file i have: After do @browser.close_all end BUT it does not close all browser windows. I get the following error message: undefined method `close_all' for #Watir::Browser:0x3dcb1b0 (NoMethodError) Is there anyone who has had a similar problem like this before? Thanks in advance, Usman Hussain -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. You received this message because you are subscribed to http://groups.google.com/group/watir-general To post: watir-general@googlegroups.com To unsubscribe: watir-general+unsubscr...@googlegroups.comwatir-general%2bunsubscr...@googlegroups.com -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. You received this message because you are subscribed to http://groups.google.com/group/watir-general To post: watir-general@googlegroups.com To unsubscribe: watir-general+unsubscr...@googlegroups.com
Re: [wtr-general] Setting text in br tags
Hi Usman, try browser.element_by_xpath(//b...@_moz_editor_bogus_node='TRUE']/).set(blah) Keith On Tue, Sep 14, 2010 at 3:00 PM, Usman Hussain usmanhhuss...@gmail.comwrote: Hi Guys, (Me Again...!) Ive come across a problem (again...) For the paragraph field for the CMS system im automating it has br tags instead of being a text_field. the html looks like this: - td class=mgnlDialogBoxInput style=width: 100%; + script src=/.resources/js/codepress/codepress.js type=text/ javascript - iframe frameborder=0 style=height: 39px; width: 100%; border: 1px solid gray; visibility: visible; position: static; display: inline; src=http://author.chimera.trunk- demo.dev.gamesys.corp/.resources/js/codepress/codepress.html? language=genericts=1284470914572 - html + head - body br _moz_editor_bogus_node=TRUE _moz_dirty= /body /html /iframe When i then enter in some text MANUALLY it changes to this: - td class=mgnlDialogBoxInput style=width: 100%; + script src=/.resources/js/codepress/codepress.js type=text/ javascript - iframe frameborder=0 style=height: 39px; width: 100%; border: 1px solid gray; visibility: visible; position: static; display: inline; src=http://author.chimera.trunk- demo.dev.gamesys.corp/.resources/js/codepress/codepress.html? language=genericts=1284470914572 - html + head - body preusman hello/pre /body /html /iframe Is there any way that I can set the text which goes into this field? by using a set(usman hello) type function? kind regards, Usman Hussain -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. You received this message because you are subscribed to http://groups.google.com/group/watir-general To post: watir-general@googlegroups.com To unsubscribe: watir-general+unsubscr...@googlegroups.comwatir-general%2bunsubscr...@googlegroups.com -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. You received this message because you are subscribed to http://groups.google.com/group/watir-general To post: watir-general@googlegroups.com To unsubscribe: watir-general+unsubscr...@googlegroups.com
Re: [wtr-general] Javascript popup on goto()
Hi Alexis, how about doing the whole lot in the execute_script part: browser = Watir::Browser.new(:firefox) browser.execute_script(' window.location=http://www.url.com;; window.confirm = function(msg) { return true; ') the window.location part replaces the goto in this case I'm not sure if the second part of the script is correct for dealing with your popup. I hope it helps. Keith On Tue, Sep 14, 2010 at 4:16 PM, balexis bale...@gmail.com wrote: Hello, I'm running Firewatir 1.6.5 on Ubuntu 10.04. I am experiencing the following problem and can't manage to find a solution at all. I instantiate a browser and use goto() to visit a given site. Upon landing on the site, I am 'greeted' with a Javascript popup, which I would like to dismiss by clicking on the OK button. However, the goto() method blocks until the popup is dismissed, so I can't use the modal_dialog or popup() objects/method. Also, calling startClicker before calling goto() has no effect. I'm guessing I would need some sort of goto_no_wait() so that I can them sleep for a while and check for the presence of a Javascript dialog and dismiss it programmatically. Can anyone think of a solution to this problem? Thanks Alexis -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. You received this message because you are subscribed to http://groups.google.com/group/watir-general To post: watir-general@googlegroups.com To unsubscribe: watir-general+unsubscr...@googlegroups.comwatir-general%2bunsubscr...@googlegroups.com -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. You received this message because you are subscribed to http://groups.google.com/group/watir-general To post: watir-general@googlegroups.com To unsubscribe: watir-general+unsubscr...@googlegroups.com
Re: [wtr-general] The problem about UTF-8
I tried your script and got a problem with the format of the text entered in firefox. However it worked fine in Internet Explorer. Could this be a firewatir or firefox issue specifically? On Fri, Sep 10, 2010 at 1:59 PM, Quang quang...@gmail.com wrote: I have a problem about UTF-8 when set text_field and click link, I searched alot of it on GROUP and Forum but can't find any answer about it. Can you help me resolve my problem. Thanks! myscript.rb require 'rubygems' require 'firewatir' Watir::Browser.default = 'firefox' ff = Watir::Browser.start(www.google.com) ff.text_field(:name,q).value = năng động mỗi ngày -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. You received this message because you are subscribed to http://groups.google.com/group/watir-general To post: watir-general@googlegroups.com To unsubscribe: watir-general+unsubscr...@googlegroups.comwatir-general%2bunsubscr...@googlegroups.com -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. You received this message because you are subscribed to http://groups.google.com/group/watir-general To post: watir-general@googlegroups.com To unsubscribe: watir-general+unsubscr...@googlegroups.com
Re: [wtr-general] How to access attribute link eg. onclick
To verify that the expected params are in place you could do something like this: if @browser.element_by_xpath(//a[contains(@onclick,'xx')]).exists? puts 'xx parameter used' end rgds Keith On Thu, Sep 9, 2010 at 5:11 AM, KH khenghuat...@gmail.com wrote: Hi all I've a link a onclick=jsmethod('xx' , 'bb') test it/a How to i access onclick attribute and retrieve the jsmethod params ?? Thanks KH -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. You received this message because you are subscribed to http://groups.google.com/group/watir-general To post: watir-general@googlegroups.com To unsubscribe: watir-general+unsubscr...@googlegroups.comwatir-general%2bunsubscr...@googlegroups.com -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. You received this message because you are subscribed to http://groups.google.com/group/watir-general To post: watir-general@googlegroups.com To unsubscribe: watir-general+unsubscr...@googlegroups.com