def save_flight(self, file_name): '''Chea chea chae''' page = util.create_page_from_file(file_name) print page sleep(3) page = util.create_page(self.driver) util.save_page(page, file_name)
def get_mileage_balance(self): '''Find the amount of miles on the page''' sleep(5) page = util.create_page(self.driver) try: if page.xpath('//span[@class="points"]'): mileage_balance = page.xpath('//span[@class="points"]' )[0].text_content().strip('\n pts.') elif page.xpath('//th'): mileage_balance = page.xpath('//th')[0].text.strip('\n ') elif page.xpath('.//div[@id="FormUserControl__' 'myOverview__mileagePlanInfo"]'): header = page.xpath('.//div[@id="FormUserControl__' 'myOverview__mileagePlanInfo"]' )[0].text_content() mileage_balance = re.search(r'Miles:(.+$)', header).group(1).replace(u'\xa0', u'') print mileage_balance except: pass