Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 98349

Try Except for selenium webdriver or requests scripts

$
0
0

Thinking of best practices, is it good to use try except when trying to get respond from requests.get(url) or using selenium webdriver.get(url) ?

Maybe more general question, when its meant to be use try except - except of file handling?

Thank you.

for example:

import requests

try:
    respond = requests.get('https://www.google.com')
    print(respond.status_code)

except Exception as e:
    print(f'error while open url - {e}')

Viewing all articles
Browse latest Browse all 98349

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>