require 'selenium-webdriver'
require 'page-object'
class SubjectSearchPage < CommonElement
include PageObject
text_field(:ssnField, :id => "SSN")
button(:searchBtn, :css => 'button[data-test-id="20180820140732083632904"]')
h2(:resultsHeaderTitle, :css => 'div[data-test-id="201808231334560745670_header"] h2.header-title')
elements(:resultRows, :css => '#bodyTbl_right > tbody > tr')
span(:result, :css => 'span[data-test-id="2016072109335505834280"]')
end
require 'selenium-webdriver'
require 'page-object'
class CommonElement
include PageObject
h2(:headerTitle, :css => 'h2')
element(:caseAppLabel, :css => '.content-item.content-label.item-2.remove-top-spacing.remove-bottom-spacing.flex.flex-row.application_name_dataLabelWrite.flex-grow.dataLabelWrite.application_name_dataLabelWrite')
link(:casesLeftMenu, :css => '.menu-item-anchor.menu-item-expand')
link(:page_title, :css => '.Application_name')
link(:footer_nav, :css => '.Footer_nav')
link(:orgPageTitle, :css => '.content-item.content-label.item-2.flex.flex-row.heading_1_dataLabelWrite.dataLabelWrite.heading_1_dataLabelWrite')
link(:searchField, :css => '#pySearchText')
#Left Nav
link(:manageSubjectsLink, :css => "li[title='Manage Subjects'] a")
link(:manageOrgLink, :css => "li[title='Manage Org'] a") #dev version
# link(:settingsLink, :css => "li[title='Settings'] a")
link(:configMgmtLink, :css => "li[title='Config Management'] a")
link(:systemSettingsLink, :css => "li[title='System Settings'] a")
#Modal
span(:modalTitle, :id =>"modaldialog_hd_title")
end
I have displayed both classes when try to convert using OCRA its throwing error. Any help ?
c:/Users/seshaddri/git/pega-functional-tests/selenium-ruby/pages/subject_mgmt/subject_search_page.rb:4:in `<top (required)>': uninitialized constant CommonElement (NameError) from C:/Bitnami/rubystack-2.3.8-1/ruby/lib/ruby/gems/2.3.0/gems/ocra-1.3.10/bin/ocra:1211:in `load' from C:/Bitnami/rubystack-2.3.8-1/ruby/lib/ruby/gems/2.3.0/gems/ocra-1.3.10/bin/ocra:1211:in `<top (required)>' from C:/Bitnami/rubystack-2.3.8-1/ruby/bin/ocra:23:in `load' from C:/Bitnami/rubystack-2.3.8-1/ruby/bin/ocra:23:in `<main>'
The error you're getting says it all:
uninitialized constant CommonElement (NameError)
This means that CommonElement
is not defined yet. Try requiring it before defining the inheritance:
require 'selenium-webdriver'
require 'page-object'
require_relative 'common_element'
# ^ new assuming CommonElement is present in ./common_element.rb
class SubjectSearchPage < CommonElement