Re: [wtr-general] undefined method `exists?' for link (PageObject gem)
Thanks for the suggestions, many ways to skin a cat! Oscar, I understand your point about an element existing but can still be not visible. Interestingly, both 'should_be present' method caused problems: undefined method `present?' for []:Array (NoMethodError) Both "on(LoginPage).signout_element.should exist" and "on(LoginPage).signout?" work now. Thanks. On Saturday, November 3, 2012 2:25:03 AM UTC+11, Justin Ko wrote: > > The page object gem automatically creates a method for checking existence > - see the docs > http://rubydoc.info/github/cheezy/page-object/master/PageObject/Accessors#link-instance_method > . > > So for: > > link(:signout, :text => 'Sign Out') > > There should be able to do: > > signout? > > - Justin Ko > > > On Friday, November 2, 2012 4:46:31 AM UTC-4, Željko Filipin wrote: >> >> Try this: >> >> Then /^I should have access to my account$/ do >> on(LoginPage).signout_element.should exist >> end >> >> Explanation: >> >> on(LoginPage).signout # clicks the link >> on(LoginPage).signout_element # returns the link >> >> More information: >> >> https://github.com/cheezy/page-object/wiki/Elements >> >> Željko >> -- >> filipin.eu >> > -- 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] undefined method `exists?' for link (PageObject gem)
Hi, I can't figure this out. I am trying to verify a links exists on a page, after user logs in, using .exists? method. It works when I use @browser.link(:text => "Sign Out") . to define the element but i want define link using PageObjedt gem using link(:signout, :text => 'Sign Out') Any ideas as to why this should happen? Thanks, Barry. ERROR: Scenario: Registered user logs in to account And a user exists When I enter my login details Then I should have access to my account undefined method `exists?' for []:Array (NoMethodError) ./features/step_definitions/login_page.rb:18:in `sign_out_link_exists' ./features/step_definitions/login_steps.rb:14:in `/^I should have access to my account$/' features/login.feature:14:in `Then I should have access to my account' CLASS FILE: class LoginPage include PageObject include DataMagic text_field(:email, :id => 'email') text_field(:password, :id => 'password') button(:signin, :id => 'loginBtn') link(:signout, :text => 'Sign Out') page_url "#{ENV['BaseUrl']}/user/signin" def login(data = {}) populate_page_with data_for(:login_page, data) signin end def sign_out_link_exists signout.exists? #@browser.link(:text => "Sign Out").exists? end end STEP DEF: Then /^I should have access to my account$/ do (on(LoginPage).sign_out_link_exists).should be_true 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
Re: [wtr-general] select_list issue -> wrong number of arguments (1 for 0) (ArgumentError)
thank you Dan. Looks like i will have to add extra steps to click on drop down button & click on a specific value, not as clean as I would have liked! On Wednesday, October 3, 2012 11:38:48 PM UTC+10, Dan wrote: > > style="display:none;" on that select is your problem. You need to trigger > whatever event is going to make that visible. Watir won't interact with an > element that isn't visible to the user, because a real user wouldn't be > able to do that either. > > On Wednesday, October 3, 2012 1:49:52 AM UTC-4, Barry Horgan wrote: >> >> >> I notice that the source html that the select section is 'greyed out' for >> all select tags on the page, I assume this is why I get the element not >> visible error:- >> >> http://screencast.com/t/Njmjvyxon >> >> I do not have this issue on the Watir-Webdriver Demo page, it's select >> tags are not 'greyed out':- >> >> >> https://spreadsheets.google.com/spreadsheet/viewform?formkey=dGtlWGJjbWhuSlAyMHhLdXc2eE0wX2c6MQ >> >> >> Barry. >> >> >> >> >> On Monday, September 24, 2012 9:02:25 AM UTC+10, Barry Horgan wrote: >>> >>> >>> still no resolution! get the following error using this code:- >>> >>> def select_redemption_option >>> puts(self.redemptionList?) >>> @browser.element(:css, "span.dropdown_btn").click >>> redemptionList_element.when_present.select 'Single' >>> puts(self.redemptionList) >>> end >>> >>> >>> timed out after 5 seconds, waiting for {:tag_name=>"select", >>> :id=>"redeumption"} to become present (Watir::Wait::TimeoutError) >>> >>> >>> I can see the test running, the drop down is clicked and the options >>> display. >>> >>> >>> >>> On Friday, September 21, 2012 6:30:01 PM UTC+10, Željko Filipin wrote: >>>> >>>> On Fri, Sep 21, 2012 at 4:03 AM, Barry Horgan >>>> wrote: >>>> > redemptionList_element.select 'Single' >>>> > throws the following error: >>>> > 'Element is not currently visible and so may not be interacted with >>>> (Selenium::WebDriver::Error::ElementNotVisibleError)' >>>> >>>> Looks like the element is not visible. >>>> >>>> Does this work? >>>> >>>> redemptionList_element.when_present.select 'Single' >>>> >>>> Ž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] select_list issue -> wrong number of arguments (1 for 0) (ArgumentError)
I notice that the source html that the select section is 'greyed out' for all select tags on the page, I assume this is why I get the element not visible error:- http://screencast.com/t/Njmjvyxon I do not have this issue on the Watir-Webdriver Demo page, it's select tags are not 'greyed out':- https://spreadsheets.google.com/spreadsheet/viewform?formkey=dGtlWGJjbWhuSlAyMHhLdXc2eE0wX2c6MQ Barry. On Monday, September 24, 2012 9:02:25 AM UTC+10, Barry Horgan wrote: > > > still no resolution! get the following error using this code:- > > def select_redemption_option > puts(self.redemptionList?) > @browser.element(:css, "span.dropdown_btn").click > redemptionList_element.when_present.select 'Single' > puts(self.redemptionList) > end > > > timed out after 5 seconds, waiting for {:tag_name=>"select", > :id=>"redeumption"} to become present (Watir::Wait::TimeoutError) > > > I can see the test running, the drop down is clicked and the options > display. > > > > On Friday, September 21, 2012 6:30:01 PM UTC+10, Željko Filipin wrote: >> >> On Fri, Sep 21, 2012 at 4:03 AM, Barry Horgan wrote: >> > redemptionList_element.select 'Single' >> > throws the following error: >> > 'Element is not currently visible and so may not be interacted with >> (Selenium::WebDriver::Error::ElementNotVisibleError)' >> >> Looks like the element is not visible. >> >> Does this work? >> >> redemptionList_element.when_present.select 'Single' >> >> Ž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
[wtr-general] Re: Selecting Dropdown via Value
Hi Adrian, could you post the code you used to solve this? I have been trying to get a solution for days and cannot figure out how to select an option from a drop down menu, it is driving me crazy!!! thanks, Barry. On Tuesday, September 25, 2012 9:30:33 PM UTC+10, Adrian Killens wrote: > > Hi There, > Does anyone know how I can select a dropdown via the value rather than the > name e.g. > > > Medium > Large > X Large > > How would I select from this dropdown using the value C? So that if I'm > testing in multiple languages I can still select. > > Cheers > Aidy > -- 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] select_list issue -> wrong number of arguments (1 for 0) (ArgumentError)
still no resolution! get the following error using this code:- def select_redemption_option puts(self.redemptionList?) @browser.element(:css, "span.dropdown_btn").click redemptionList_element.when_present.select 'Single' puts(self.redemptionList) end timed out after 5 seconds, waiting for {:tag_name=>"select", :id=>"redeumption"} to become present (Watir::Wait::TimeoutError) I can see the test running, the drop down is clicked and the options display. On Friday, September 21, 2012 6:30:01 PM UTC+10, Željko Filipin wrote: > > On Fri, Sep 21, 2012 at 4:03 AM, Barry Horgan > > > wrote: > > redemptionList_element.select 'Single' > > throws the following error: > > 'Element is not currently visible and so may not be interacted with > (Selenium::WebDriver::Error::ElementNotVisibleError)' > > Looks like the element is not visible. > > Does this work? > > redemptionList_element.when_present.select 'Single' > > Ž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] select_list issue -> wrong number of arguments (1 for 0) (ArgumentError)
using redemptionList_element.select 'Single' throws the following error: 'Element is not currently visible and so may not be interacted with (Selenium::WebDriver::Error::ElementNotVisibleError)' I was hoping not to have to go the route of clicking on the selector and clicking on a specific value. Works through Selenium IDE using 'select | id=redeumption | label=Single (@driver.find_element(:id, "redeumption")).select_by(:text, "Single") On Wednesday, September 19, 2012 8:58:38 PM UTC+10, Željko Filipin wrote: > > On Wed, Sep 19, 2012 at 8:02 AM, Barry Horgan > > > wrote: > > no longer getting the error message but the value is not being selected, > it remains at the default value of 'Select'. > > i am assuming that i do not need to click the actual drop down arrow to > make all options visible first, is this correct? > > That is usually not needed. Try this: > > redemptionList_element.select 'Single' > > Does that select the value? > > Ž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] select_list issue -> wrong number of arguments (1 for 0) (ArgumentError)
thanks Željko. I tried you solution: redemptionList = 'Single' no longer getting the error message but the value is not being selected, it remains at the default value of 'Select'. i am assuming that i do not need to click the actual drop down arrow to make all options visible first, is this correct? On Thursday, September 13, 2012 6:54:49 PM UTC+10, Željko Filipin wrote: > > On Thu, Sep 13, 2012 at 6:09 AM, Barry Horgan > > > wrote: > > self.redemptionList.select 'Single' > > Try this (I do not think you need "self" here): > > redemptionList = 'Single' > > More information: > > https://github.com/cheezy/page-object/wiki/Elements > > Željko > -- > filipin.eu > -- 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] select_list issue -> wrong number of arguments (1 for 0) (ArgumentError)
Hi, i have been struggling to get this to work today, looked through a lot of examples and previous threads but still unable to find a solution. I know it must be something simple - i just can see it! I am using Cheezy's page-object gem & trying to select an option from a drop down list on the page. Page source code: Select Single Double Queen King Test code: ... select_list(:redemptionList, :id => "redeumption") ... def select_redemption_option puts(self.redemptionList?) self.redemptionList.select 'Single' end Error: wrong number of arguments (1 for 0) (ArgumentError) ./features/pages/purchase_page.rb:36:in `select' ./features/pages/purchase_page.rb:36:in `select_redemption_option' Any help would be appreciated! -- 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] Passing two arguments from feature file to step definition
thanks Željko, that works for me. On Friday, July 20, 2012 6:49:48 PM UTC+10, Željko Filipin wrote: > > On Fri, Jul 20, 2012 at 2:22 AM, Barry Horgan > > > wrote: > > When I add credits to users account "" "" > > ... > > > Step definition: > > > > def add_credits (credit_amount, expiry_date) > > @browser.link(:text => "Add Credit").click > > @browser.frame(:id => "credit-add").input(:id => "amount").send_keys > credit_amount > > @browser.frame(:id => "credit-add").input(:id => "expiry").send_keys > expiry_date > > @browser.frame(:id => "credit-add").input(:id => > "comment").send_keys "test" > > end > > This is not step definition. It should look like this: > > When /^I add credits to users account "(.*)" "(.*)"$/ do |credit_amount, > expiry_date| > # code > end > > Željko > -- > filipin.eu > -- 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] Passing two arguments from feature file to step definition
i am having a problem with a feature file that i am currently working on, i want to pass two arguments from one line of the feature file (from table) to my step definition - is this possible? any of the examples i have looked at in The Cucumber Book seem to have one argument per line. Feature file: When I add credits to users account "" "" |credit_amount|expiry_date| |100 |31/07/2012 | |100 |01/01/2020 | Then I should see amount and expiry date displayed Step definition: def add_credits (credit_amount, expiry_date) @browser.link(:text => "Add Credit").click @browser.frame(:id => "credit-add").input(:id => "amount").send_keys credit_amount @browser.frame(:id => "credit-add").input(:id => "expiry").send_keys expiry_date @browser.frame(:id => "credit-add").input(:id => "comment").send_keys "test" end Error: Your block takes 2 arguments, but the Regexp matched 3 arguments. (Cucumber::ArityMismatchError) Any help would be appreciated, thanks! -- 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