首页 > 解决方案 > Python - Selenium wrong url or server out of reach

问题描述

How to handle url exceptions. If user enter a wrong url or the server does not response

browser = webdriver.Chrome('chromedriver')
browser.get('http://www.abc.abc/')

I am using python. Program does not throw error if url is wrong or server out of reach

标签: pythonseleniumexception

解决方案


如何处理任何异常示例

try:
    browser.get('http://www.abc.abc/')
except Exception as e:
    print("except -> browser.get -> %s" %e)

推荐阅读