Created
December 28, 2021 13:23
-
-
Save onetown/5a90ce287bb838df1d3561138d8d06f6 to your computer and use it in GitHub Desktop.
test sites
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from selenium import webdriver | |
from selenium.webdriver.common.keys import Keys | |
import time | |
import re | |
sites=[] | |
dirver = webdriver.Chrome() | |
def load_page(site): | |
start = time.time() | |
dirver.get(site[4]) | |
end = time.time() | |
elapsed = end -start | |
print('====== end test - %s,%s,%s,%s seconds' % (site[0], site[3], site[4], elapsed)) | |
def load_list(file): | |
with open(file, 'r') as f: | |
for line in f: | |
arr = line.split(',') | |
id = arr[0] | |
kind = arr[1] | |
region = arr[2] | |
name = arr[3] | |
url = arr[4] | |
if not url.startswith('http'): | |
url = 'https://' + url | |
a = re.findall('https?://(?:[-\w.]|(?:%[\da-fA-F]{2}))+', url) | |
load_page((id, kind, region, name, url)) | |
def __main__(): | |
load_list('/Users/liangbo/Downloads/weblist.csv') | |
dirver.close() | |
if __name__ == '__main__': | |
__main__() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment