This commit is contained in:
Edward Betts 2023-08-11 08:36:05 +01:00
parent 348162169f
commit 9cd6e6b9e3

View file

@ -1,7 +1,7 @@
#!/usr/bin/python3
import os
from datetime import datetime
from datetime import datetime, date
from playwright.sync_api import Playwright, Request, expect, sync_playwright
@ -12,6 +12,9 @@ return_label = "Select your Return tickets from Calais to Folkestone"
choose_your_tickets = "https://www.eurotunnel.com/book/ChooseYourTickets/(0)"
outbound_date = date(2023, 9, 29)
return_date = date(2023, 10, 6)
def data_filename(page_type: str, ext: str = "html") -> str:
"""Filename to use for saving data."""
@ -51,12 +54,24 @@ def run(playwright: Playwright) -> None:
context = browser.new_context()
page = context.new_page()
hr = HandleResponse()
page.on("requestfinished", hr.requestfinished)
# hr = HandleResponse()
# page.on("requestfinished", hr.requestfinished)
page.goto("https://www.eurotunnel.com/uk/")
page.get_by_role("button", name="Accept All Cookies").click()
page.get_by_role("textbox", name="Outbound").click()
month = page.locator("div.ui-datepicker-month").first
print(month)
print(month.text_content())
page.close()
context.close()
browser.close()
return
page.get_by_role("row", name="August 2023").get_by_role("cell").nth(1).click()
page.get_by_role("cell", name="29").click()
page.get_by_role("textbox", name="Return").click()