I have an issue that: if 'for' loop started and first condition 'false' it kept going to 'else' even the 'if' became 'true', I need to stay in the loop but stop if statement to start looping all if statements, I hope I explained the question in a clear way, I tried break(), pass() and continue() and all of them stop the loop.
while True:
print('Teeest Looop')
if (Actual_Time == Static_Time) :
print('Teeest')
options = Options()
options.add_argument("--user-data-dir=chrome-data")
options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_experimental_option('useAutomationExtension', False)
driver = webdriver.Chrome('C:\\Users\\hana\\Downloads\\chromedriver_win32\\chromedriver.exe', options=options)
driver.maximize_window()
driver.get('https://web.whatsapp.com')
time.sleep(20)
driver.find_element_by_xpath("//*[@title='hana']").click()
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH,'//*[@id="main"]/footer/div[1]/div[2]/div/div[2]'))).send_keys('test sending')
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//button[@class='_2Ujuu']"))).click()
time.sleep(10)
driver.close()
elif (Actual_Time != Static_Time) :
print('Not lucky time')
Aucun commentaire:
Enregistrer un commentaire