Sha256: 84315ead2b9f6113c7b33189d792863db11e2e311b66548de624faf6aba9fd48

Contents?: true

Size: 775 Bytes

Versions: 2

Compression:

Stored size: 775 Bytes

Contents

module ARBookFinder
  class PaginationProcessor
    include Capybara::DSL
    
    SEARCH_GOTO_FIELD = 'ctl00_ContentPlaceHolder1_ucSeachResults_txtPageToGoToTop'
    SEARCH_SUBMIT_BUTTON = 'ctl00_ContentPlaceHolder1_ucSeachResults_btnGoToPageTop'
    
    COLLECTION_GOTO_FIELD = 'ctl00_ContentPlaceHolder1_ucCollection_ucSeachResults_txtPageToGoToTop'
    COLLECTION_SUBMIT_BUTTON = 'ctl00_ContentPlaceHolder1_ucCollection_ucSeachResults_btnGoToPageTop'

    def initialize(page, collection = false)
      @page = page
      @field_const = collection ? :COLLECTION : :SEARCH
    end

    def process
      fill_in(self.class.const_get(:"#{@field_const}_GOTO_FIELD"), with: @page)
      click_button(self.class.const_get(:"#{@field_const}_SUBMIT_BUTTON"))
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ar_book_finder-1.1.1 lib/ar_book_finder/pagination_processor.rb
ar_book_finder-1.1.0 lib/ar_book_finder/pagination_processor.rb