-1

I know if we want to discontinue the loop when some thing found in the page like

    if "page not found"  in browser.page_source:
        return

but how it would be if something not found in the page source then return...

for i.e. but this doesn't work

    if "next page"  not in browser.page_source:
        return

please how to fix it..

Bostan
  • 77
  • 1
  • 9

1 Answers1

0

You can add your code in the try-except block

try:
return str("your text") in self.driver.page_source
except:
return false

Checkout this link - how can I check if some text exist or not in the page?

Community
  • 1
  • 1
Sanchita
  • 84
  • 3