I am trying to change the checkin and checkout date in the following url: https://www.booking.com/hotel/fr/le-leman.fr.html?label=gen173nr-1DCAEoggI46AdIM1gEaCyIAQGYAQ24ARjIAQzYAQPoAQGIAgGoAgS4AuGugoYGwAIB0gIkODQyNzI0MzUtNzlmZi00ZTY1LWJkNGUtZmQyMGIxMGE3NzJl2AIE4AIB;sid=1a1526834c348b388f7097913631c2e3;checkin=2021-06-09;checkout=2021-06-10;sig=v11C1wtOKO
I thought about using a Regex rule to set today's date:
d = datetime.date.fromordinal(datetime.date.today().toordinal()-0).strftime("%m/%d/%Y")
url = driver.current_url
regex = r"^\d{4}\-(0?[1-9]|1[012])\-(0?[1-9]|[12][0-9]|3[01])$"
result = re.sub(regex, d, url, 0)
if result:
print (result)
But it's doesen't work.
Thank's you for your attention.
PS : SORRY I have a bad english..