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
尝试使用OCRA转换其投掷错误时,我都显示了这两个类。有帮助吗?
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>'
您遇到的错误说明了这一切:
非初始化的常量共同元素(nameRror)
这意味着尚未定义CommonElement
。在定义继承之前尝试需要它:
require 'selenium-webdriver'
require 'page-object'
require_relative 'common_element'
# ^ new assuming CommonElement is present in ./common_element.rb
class SubjectSearchPage < CommonElement