问题描述:

Is there any specific command or logic that I can go back to a specific line in code and iterate from that point?

Below is my code example:

self.driver.implicitly_wait(0.3)

while True:

try:

models = [

('%s' % o.get_attribute('text'), '%s' % parse.unquote(o.get_attribute('href')))

for o

in self.driver.find_elements_by_css_selector("#layer_group ul.list li a")

if o.text != '전체'

]

except (StaleElementReferenceException, NoSuchElementException):

continue

break

When the WebDriverException occurs, I would like to go back to the first line of the sample code. Is there any specific command or logic for that except for the way that puts "self.driver.implicitly_wait(0.3)" into the while loop?

相关阅读:
Top