I've created a py file. In this script:
- Log on to a website
- Select the data
- Select the time
After selecting the correct time an new pop-up screen is opened. In this screen I have to fill in some fields. But my py file does not recognize the new pop up screen. The URL of the new pop-up screen is different everytime (based on date etc).
Can you help me what I have to do in the PY script, so Python does know that he has to perform action in the new pop-up screen??
from selenium import webdriverfrom selenium.webdriver.common.by import Byfrom selenium.webdriver.common.keys import Keysfrom selenium.webdriver.support.ui import WebDriverWaitfrom selenium.webdriver.support import expected_conditions as ECimport time# Initialize the WebDriverdriver = webdriver.Chrome() # Open de websitedriver.get("https://bent.baanreserveren.nl") # Tijd om scherm goed te stellentime.sleep(1)# Vul Gebruikersnaam indriver.find_element(By.NAME, "username").send_keys("username")# Vul Wachtwoord indriver.find_element(By.NAME, "password").send_keys("password")# Klik op Inloggendriver.find_element(By.CSS_SELECTOR, ".form-submit3 > .button3").click()# Juiste dag (3x klikken)< let op wijzigen nadat het correct isfor _ in range(2): element = driver.find_element(By.CSS_SELECTOR, ".matrix-date-nav:nth-child(3)") element.click() time.sleep(1) # Selecteer Padel Buiten uit Dropdown lijstdropdown_element = driver.find_element(By.ID, "matrix-sport")dropdown_element.click()element = dropdown_element.find_element(By.XPATH, "//option[. = 'Padel Buiten']")element.click()time.sleep(1)# Selecteer baan 3, tijdstip 21:00 uur element = driver.find_element(By.CSS_SELECTOR, "tr:nth-child(57) > .r-4436 > .slot-period")element.click()# FROM THIS POINT HE IS OPENING AN NEW POP-UP SCREEN AND I HAVE GO FURTHER ON THE NEW SCREEN# Sluit de websitedriver.quit()
Hoping to find the solution