Skip to content

Instantly share code, notes, and snippets.

@omgreenfield
Last active October 17, 2019 00:25
Show Gist options
  • Save omgreenfield/abc995669812e80aeec48b0b0ec234d3 to your computer and use it in GitHub Desktop.
Save omgreenfield/abc995669812e80aeec48b0b0ec234d3 to your computer and use it in GitHub Desktop.
expedia_selenium_example

Directory structure

  • pages
  • drivers
  • cases
  • suites

pages/home

  class HomePage
    def flightButton
      return find_element_by_css('button[data-lob=flight]')
    end

    def flightPanel
      return find_element_bs_css('#flight-panel')
    end
  
    def flyingFromField
      return find_element_bs_css('input[data-lob')
    end
  end

drivers/home

  class HomePageDriver
    def initialize(page = HomePage)
      @page = page
    end

    def clickFlightButton
      page.flightButton.click()
      waitFor(page.flightPanel).present()
    end

    def enterFlyingFrom(text)
      page.flyingFromField.input(text)
    end
  end

cases/search_for_flight

  class SearchForFlight
    def initialize(driver = HomePageDriver)
      @driver = driver
    end

    def execute
      driver.clickFlightButton()
      driver.enterFlyingFrom()
    end
  end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment