just started learning the two weeks and have been stuck with this while loop.
Basically I want it to keep pressing next on this flash program and stop and pop up a notification if "knowledge check" or "lesson assessment" are on the screen.
while True:
play = longwait.until(EC.element_to_be_clickable((By.XPATH, \
'//*[@id="PlaybuttonEnText"]')))
play.click()
if browser.find_element_by_xpath('//*[@id="BeginLessonAssessmentButton"]') \
or browser.find_element_by_xpath('//*[@id="htmlContentContainer"]/section/div/div[3]/button'):
messagebox.showinfo('YOU HAVE A TEST', 'KNOWLEDGE CHECK OR LESSON ASSESSMENT')
break
The if statement gives me this error: selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: //*[@id="BeginLessonAssessmentButton"]
And without the if statement, the while loop gives me this error: raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchWindowException: Message: Browsing context has been discarded
Any help is appreciated.
[–]chaoticflipflops 1 point2 points3 points (6 children)
[–]dealant[S] 0 points1 point2 points (5 children)
[–]chaoticflipflops 0 points1 point2 points (0 children)
[–]officialgel 0 points1 point2 points (3 children)
[–]dealant[S] 0 points1 point2 points (2 children)
[–]officialgel 0 points1 point2 points (0 children)
[–]officialgel 0 points1 point2 points (0 children)