Watir::Exception::UnknownObjectException: unable to locate element

10 views
Skip to first unread message

Ajay Reddy

unread,
Aug 10, 2016, 12:52:40 PM8/10/16
to Cukes
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
      end
    end


  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.
Reply all
Reply to author
Forward
0 new messages