0
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>'
4

1 回答 1

0

你得到的错误说明了一切:

未初始化的常量 CommonElement (NameError)

这意味着CommonElement尚未定义。在定义继承之前尝试要求它:

require 'selenium-webdriver'
require 'page-object'

require_relative 'common_element'
# ^ new assuming CommonElement is present in ./common_element.rb

class SubjectSearchPage < CommonElement
于 2019-02-26T16:16:29.533 回答