Ahoj, jak by jste si tady vyložili uvodní anglický text. A pak dále v kodu, chápu dobře, že Break ukončí smyčku hned po prvním projití cyklem, at uz je podmínka True nebo False. Dekuji
from selenium import webdriver
from selenium.common.exceptions import StaleElementReferenceException
import time
driver= webdriver.Firefox(')
driver.get('http://apress.com')
driver.find_element_by_name('query').send_keys('python selenium')
while True:
ꂠꂠꂠꂠtry:
ꂠꂠꂠꂠꂠꂠꂠꂠꂠꂠꂠs=driver.find_element_by_class_name('search__submit')
ꂠꂠꂠꂠꂠꂠꂠꂠs.submit()
ꂠꂠꂠꂠꂠꂠꂠꂠtime.sleep(2)
ꂠꂠꂠꂠꂠꂠꂠꂠs.submit()
ꂠꂠꂠꂠexcept StaleElementReferenceException:
ꂠꂠꂠꂠꂠꂠꂠꂠprint('Stale Exception is Skipped.')
ꂠꂠꂠꂠbreak
driver.quit()
Kod s textem:
Stale
exception is raised in the following program by submitting the web element after a
while of its first submission. The handled exception is ignored or skipped that tries to
terminate a test case.