Improvements
This commit is contained in:
parent
67dbfed7b4
commit
ebc7bc5721
12
check.py
12
check.py
|
@ -1,6 +1,7 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
import os
|
||||
import re
|
||||
from datetime import date, datetime
|
||||
|
||||
from playwright.sync_api import Playwright, Request, expect, sync_playwright
|
||||
|
@ -57,14 +58,23 @@ def run(playwright: Playwright) -> None:
|
|||
# hr = HandleResponse()
|
||||
# page.on("requestfinished", hr.requestfinished)
|
||||
|
||||
re_month_name = re.compile(r"^([A-Z][a-z]+) (\d{4})$")
|
||||
|
||||
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()
|
||||
page.get_by_role("row", name="August 2023").get_by_role("cell").nth(1).click()
|
||||
month_row = page.get_by_role("row", name=re_month_name)
|
||||
month_and_year = month_row.inner_text()
|
||||
if month_and_year == "August 2023":
|
||||
month_row.get_by_role("cell").nth(1).click()
|
||||
# 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()
|
||||
page.get_by_role("row", name="September 2023").get_by_role("cell").nth(2).click()
|
||||
page.get_by_role("cell", name="6", exact=True).click()
|
||||
|
||||
page.get_by_role("button", name="Search and book").click()
|
||||
page.get_by_label("Enter your vehicle registration").fill("KE69HRR")
|
||||
page.get_by_role("button", name="Find").click()
|
||||
|
|
Loading…
Reference in a new issue