Program Ended Without Completing The Task
When I run my script, it is ended before completing the task that is in while loop. driver = webdriver.Chrome() driver.get('http://example.com') #input('Press any key to continue1'
Solution 1:
Your code has an obvious flaw in logic:
s_b_c_status = "False"while s_b_c_status == "True"
You've defined s_b_c_status
as "False"
, so your while
loop will not do even a single iteration...
If you need to wait for element to appear in DOM, try to implement ExplicitWait:
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import TimeoutException
driver = webdriver.Chrome()
driver.get('http://example.com')
try:
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//div[@role='button' and @title='Status']")))
except TimeoutException:
print("Element not found")
Post a Comment for "Program Ended Without Completing The Task"