I would like to perform a check.If I excecute the actions in block 1 within 3 seconds, the script has to go to the last block of the image (time sleep). But if the actions taking more than 3 seconds, he should go to block 2 and then to the last block of the image (time sleep). Number 4 is the last of the three blocks which should be executed only if block 1 and block 2 took too long time.
Could you help me?
# Bepaal het juiste schermoriginal_window = driver.current_window_handle# Selecteer baan 3, tijdstip 21:00 uur element = driver.find_element(By.CSS_SELECTOR, "tr:nth-child(13) > .r-4436 > .slot-period")element.click()baan_boeking = 3# Ga naar het nieuwe pop-up scherm, waar gegevens ingevuld kunnen wordenfor window_handle in driver.window_handles: if window_handle != original_window: driver.switch_to.window(window_handle) break# Selecteer baan 2, tijdstip 21:00 uur element = driver.find_element(By.CSS_SELECTOR, "tr:nth-child(13) > .r-4435 > .slot-period")element.click()baan_boeking = 2# Ga naar het nieuwe pop-up scherm, waar gegevens ingevuld kunnen wordenfor window_handle in driver.window_handles: if window_handle != original_window: driver.switch_to.window(window_handle) break# Selecteer baan 4, tijdstip 21:00 uur element = driver.find_element(By.CSS_SELECTOR, "tr:nth-child(13) > .r-4437 > .slot-period")element.click()baan_boeking = 4# Ga naar het nieuwe pop-up scherm, waar gegevens ingevuld kunnen wordenfor window_handle in driver.window_handles: if window_handle != original_window: driver.switch_to.window(window_handle) break# Scherm goed zettentime.sleep(1)