Last active
July 24, 2017 14:50
-
-
Save jesus-sayar/c857be6e0c3a893bbef60ab4697195ee to your computer and use it in GitHub Desktop.
Dummy hotel probe using Selenium
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DummyHotel(Probe): | |
URL = 'http://www.dummy-hotel.com' | |
DESTINATION = 'Vigo, Galicia' | |
def execute(self): | |
self.visit_home() | |
self.search_destination() | |
self.select_hotel() | |
self.select_room() | |
self.checkout() | |
def visit_home(self): | |
self.web_driver.get(self.URL) | |
self.store_web_requests(step='home_page') | |
def search_destination(self): | |
location = self.web_driver.find_element_by_id("search-location") | |
location.send_keys(self.DESTINATION) | |
location.submit() | |
def select_hotel(self): | |
hotels = self.web_driver.find_elements_by_css_selector(".hotelContainer .hotelItem") | |
self.store_web_requests(step='select_hotel_page') | |
hotels[0].click() | |
def select_room(self): | |
rooms = self.web_driver.find_elements_by_css_selector('.roomsContainer .roomItem') | |
self.store_web_requests(step='select_room_page') | |
rooms[0].click() | |
def checkout(self): | |
self.store_web_requests(step='checkout_page') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment