Hi I am having a problem which is driving me mad, When my code complies I receive the error
uninitialized constant BaseHelper (NameError)
My code had been working completely fine, up until the point where I added another subclass (AccessoriesMerchandise) my classes look like this
BaseHelper class:
class BaseHelper
def find(locator)
@browser.find_element locator
end
def type(locator, input)
find(locator).send_keys input
end
end
Child class:
class FindADealerPage < BaseHelper
#PageObjects
FIND_A_DEALER_SEARCH_FIELD = {id: "abcd"}
MAP_TAB = {css: 'abcd abcd abcd'}
SERVICE_CHECK_BOX = {class: "abcd"}
SUBMIT_SEARCH = {class: "abcd"}
DEALER_RESULTS_FIRST_DEALER = {css: "abcd"}
def initialize(browser, wait)
@browser = browser
@wait = wait
end
def go_to_find_a_dealer_page
@browser.get $base_url
end
end
They are both sitting in the same folder! I added this class where my problems started.
class AccessoriesMerchandise < BaseHelper
#PageObjects
ACCESSORIES_ACCORDION = {css: 'div.mesSpecAccordion.accessoriesAccordion'}
PANEL_CLOSED = {css: 'h2.trigger'}
PANEL_OPENED_ACTIVE = {css: 'h2.trigger.active'}
def initialize(browser, wait)
@browser = browser
@wait = wait
end
def go_to_page
@browser.get $base_url
end
end
This class is also sitting in the same folder. The framework I am using is, Ruby Selenium WebDriver, Cucumber and Rspec Expectations
You need to require
it
It should be something like [As you told both are in same folder]
require 'base_helper.rb'
class FindADealerPage < BaseHelper
#PageObjects
FIND_A_DEALER_SEARCH_FIELD = {id: "abcd"}
MAP_TAB = {css: 'abcd abcd abcd'}
SERVICE_CHECK_BOX = {class: "abcd"}
SUBMIT_SEARCH = {class: "abcd"}
DEALER_RESULTS_FIRST_DEALER = {css: "abcd"}
def initialize(browser, wait)
@browser = browser
@wait = wait
end
...
end
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.