from selenium import webdriver
from selenium.common.exceptions import TimeoutException
browser = webdriver.PhantomJS()
browser.set_page_load_timeout(30)
try:
browser.get('https://yandex.ru')
except TimeoutException:
print("can't load page")
browser.quit()
with open('filename', 'r') as file:
proxy_list = file.readlines()
for proxy in proxy_list:
service_args = [
'--proxy={}'.format(proxy),
'--proxy-type=http',
]