Same error being the page doesn't load, even though you have a properly formatted page_url defined and are using the visit method on the class? Need to see the updated code. You can also try putting a sleep before the click to see if the page is loading but hasn't finished before trying to click on your element.
On Wednesday, August 10, 2016 at 1:37:10 PM UTC-5, Ajay Reddy wrote: > > I have changed from gto to page_url and instead #on I am using #visit but > I am getting same error. > > On Wednesday, August 10, 2016 at 12:32:32 PM UTC-5, Titus Fortner wrote: >> >> That's a page object, it doesn't show your step code. >> Best practice is to define a page_url and use #visit instead of #on >> https://github.com/cheezy/page-object/wiki/Creating-and-using-page-objects >> >> On Wed, Aug 10, 2016 at 12:19 PM, Ajay Reddy <[email protected]> >> wrote: >> >>> Here is the data for xxx website and taking data from yaml file. >>> >>> class UserInfo >>> include PageObject >>> include DataMagic >>> >>> >>> text_field(:first_name, :id => 'b_firstname') >>> text_field(:last_name, :id => 'b_lastname') >>> text_field(:email_id, :id => 'reg_email') >>> radio(:gender, :css => 'ml_panelregistration_field_optionbox') >>> text_field(:password, :id => 'password1') >>> text_field(:confirm_password, :id => 'password2') >>> text_field(:addressline1, :id => 'b_address' ) >>> text_field(:addressline2, :id => 'b_address_2') >>> text_field(:city, :css => 'ml_panelregistration_field_textbox') >>> select_list(:state, :id => 'state') >>> text_field(:dateofbirth, :id => 'datepicker') >>> text_field(:pincode, :id => 'b_zipcode' ) >>> text_field(:mobile, :css => 'ml_panelregistration_field_textbox') >>> >>> >>> def fill_user_information >>> DataMagic.yml_directory = 'features/lib/Config/data' >>> DataMagic.load("user_from.yml") >>> populate_page_with data_for(:User_Data, data) >>> end >>> >>> end >>> >>> On Wednesday, August 10, 2016 at 12:01:22 PM UTC-5, Titus Fortner wrote: >>>> >>>> Data is what is displayed by default when open a new browser. Your "Given >>>> I am on xxx homepage" is not working as desired. >>>> >>>> On Wednesday, August 10, 2016 at 11:51:33 AM UTC-5, Ajay Reddy wrote: >>>>> >>>>> Hi All, >>>>> >>>>> I am using page factory pattern, >>>>> >>>>> 1. >>>>> >>>>> Here is My class Homepage:- >>>>> >>>>> >>>>> class Homepage >>>>> include PageObject >>>>> include Configuration >>>>> >>>>> def open >>>>> goto("url") >>>>> end >>>>> >>>>> def sign_in >>>>> @browser.element(css: 'div.links-static ul li.account >>>>> div#login_user_data a.account').click -------------> I am >>>>> getting the error here >>>>> end >>>>> >>>>> def create_account >>>>> @browser.element(css: >>>>> 'div.ml_function.ml_function_arrowtoptoleft.padding_top_twenty.height_fifty >>>>> input.ml_function_button_createaccountRegister').click >>>>> endend >>>>> >>>>> 2. >>>>> >>>>> >>>>> >>>>> When(/^I click on sign in$/) do -------------> I am getting the >>>>> error here >>>>> on(Homepage).sign_in >>>>> end >>>>> >>>>> >>>>> 3. >>>>> >>>>> Scenario: User needs to create a new account >>>>> 4. >>>>> >>>>> Given I am on xxx homepage >>>>> >>>>> 5. >>>>> >>>>> When I click on sign in -------------> I am getting the >>>>> error here >>>>> 6. >>>>> >>>>> And I fill the user information >>>>> 7. >>>>> >>>>> And I click Create Account >>>>> 8. >>>>> >>>>> Then I should see the user details >>>>> >>>>> I am getting this error Watir::Exception::UnknownObjectException: >>>>> unable to locate element, using {:css=>"div.links-static ul li.account >>>>> div#login_user_data a.account"} >>>>> ./features/lib/pages/Homepage.rb:12:in `sign_in' >>>>> ./features/step_definitions/Homepage_steps.rb:6:in `/^I click on sign >>>>> in$/' >>>>> ./features/Homepage.feature:9:in `When I click on sign in' >>>>> >>>>> When I run the scenario what exactly I experienced is:- The browser >>>>> is opened but the url is not displaying in search bar, in search bar it >>>>> is >>>>> displaying the "data:,". I don't know why it is displaying the data. >>>>> >>>>> >>>>> Thank You, >>>>> Ajay. >>>>> >>>> -- >>> -- >>> 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] >>> >>> --- >>> You received this message because you are subscribed to the Google >>> Groups "Watir General" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- -- 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] --- You received this message because you are subscribed to the Google Groups "Watir General" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
