Re: [wtr-general] Watir page objects variables
Rahul, it looks like you are testing using Cucumber, and it's really a Cucumber question. It looks like it should work, instance variables in Cucumber live for a duration of one scenario, if I'm not mistaken. If you want, you can try to switch from Ruby instance variables to class variables: @@successful_page, etc. Class variables will live during an entire Cucumber run. If it does not work, post an entire stack trace to a Cucumber mailist, please. -- DK AIM: DKroot1, Skype: DKroot On 6/3/11 12:44 PM, Rahul Sharma wrote: Hi Guys, I have got a problem that I run into frequently using the page object pattern for Watir and was wondering if anyone could help. I have a booking page on which a user could click book button to book an event. If the user is eligible for the booking, a Succesful booking page is returned and if not then Requirement not met page is returned. Currently following the page object pattern I have different page classes for each page. So my code goes like this: My feature file: Scenario 1: When I book event #(member eligible) Then Successful booking page should be displayed Scenario 2: When I book event #(member not eligible) Then Requirement not met page should be displayed My Ruby file: When "I book an event" do @booking_page.book_event end Then "Successful booking page should be displayed" do @successful_page.should be_displayed Then "Requirement not met page should be displayed" do @requirement_not_met_page.should be_displayed end My book_event method that evaluates the page to be returned is like this: def book_event book_button.click if @browser.url =~ /requirementNotMet/ @requirement_not_met_page=Pages::WhiteLabel::Community::RequirementNotMetPage.new(@browser) else @successful_page=Pages::WhiteLabel::Community::SuccessfulBookingPage.new(@browser) end end Now this does not seem to work and I get method not defined for Nil Class error. So I guess in the book_event method, the page objects from teh two classes are not being assigned to the variables. Any ideas how I can do this? Thanks in advance -- 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] Is the fire_event working on firefox?
On Fri, Jun 3, 2011 at 8:57 PM, a b wrote: > I have to click on the row and I've try the following:: > nothing happened. Sounds to me that you have to explicitly fire javascript event: http://stackoverflow.com/questions/3787555/how-to-find-out-which-javascript-events-fired Željko -- 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] click on hidden buttons not working anymore on watir-webdriver
Den 3. juni 2011 kl. 21:02 skrev a b : On Firefox I have to press Enter Key after I type in some text. Do you have any example? I couldn't find any example on stackoverflow; watir google etc. element.send_keys :enter Thanks a lot. Cristina -- 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] Re: click_no_wait again
How did you manage to exactly fix it with #goto? Jarmo On Jun 3, 7:32 am, Babitha wrote: > Finally, I found what the issue was. > > It is happening because I am using IE.attach to attach to the page > instead of using browser.Start or browser.goto. > With browser.goto things started working fine. > > Apparently the error message that was logged by the $DEBUG= true > itself helped me. I saw that internally there is again a call to do an > IE.attach, and I guessed that may be failing. Please see the relevant > part of the error message below: > > Watir::Button.new(Watir::IE.attach(:hwnd, > 591236), :unique_number, 4).click!();" > > On Jun 2, 1:50 pm, Babitha wrote: > > > > > > > > > Trust me. I have done my research. I know there were already many > > issues reported with element.click_no_wait and most of them are > > supposed to be fixed. But, I still have this problem with the latest > > version of watir. > > > I am pretty sure with the same version of ruby it worked for me in > > another system, but as far as I can remember the watir version was an > > earlier one. > > > My current ruby version is 1.86-26 p(111), watir -1.8.1 > > OS: Windows 7, IE 8. > > > Here is the problem. > > > I have a button on my page, clicking on which it displays a javascript > > confirmation dialog. I tried it with click() function, and it works > > fine. But, with click_no_wait() nothing happens, and the control just > > passes on to the next statement. > > Below is my code: > > > $b = Watir::IE.attach(:url, "myurl") > > sleep(2) > > > btn = $b.button(:id, "btnClear") > > $DEBUG = true > > btn.click_no_wait() > > $DEBUG=false > > > My page does not use frames. > > > As was suggested in some earlier questions, I put $DEBUG=true and > > $DEBUG=false statements around the click_no_wait call and below is > > what I got. > > > #no_wait command: > > Exception `WIN32OLERuntimeError' at c:/ruby/lib/ruby/gems/1.8/gems/ > > watir-1.8.1/lib/watir/element.rb:208 - > > ruby -e "$:.unshift('c:/ruby/lib/ruby/gems/1.8/gems/watir-1.8.1/lib/ > > watir/win32ole').unshift('c:/ruby/lib/ruby/gems/1.8/gems/ > > commonwatir-1.8.1/lib').unshift('c:/ruby/lib/ruby/gems/1.8/gems/ > > firewatir-1.8.1/lib').unshift('c:/ruby/lib/ruby/gems/1.8/gems/ > > watir-1.8.1/lib');require 'c:/ruby/lib/ruby/gems/1.8/gems/watir-1.8.1/ > > lib/watir/core';Watir::Button.new(Watir::IE.attach(:hwnd, > > 591236), :unique_number, 4).click!();" > > OLE error code:0 in > > > > HRESULT error code:0x80070057 > > The parameter is incorrect. > > c:/ruby/lib/ruby/gems/1.8/gems/watir-1.8.1/lib/watir/element.rb:58:in > > `assert_exists': Unable to locate element, using :unique_number, 4 > > (Watir::Exception::UnknownObjectException) > > from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.8.1/lib/watir/ > > element.rb:275:in `click!' > > from -e:1 > > > I have gone > > throughhttp://jira.openqa.org/browse/WTR-320andhttp://jira.openqa.org/browse > > > Can somebody please help me with this? > > Thanks, > > Babitha -- 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