def gethtml(zurl,str_fname):
mobileEmulation = {'deviceName': 'Apple iPhone 6'}
options = webdriver.ChromeOptions()
options.add_experimental_option('mobileEmulation', mobileEmulation)
driver = webdriver.Chrome(executable_path='chromedriver.exe', chrome_options=options)
driver.get(zurl)
time.sleep(5)
result = []
# for i in range(0,300): #???0?20?????i?
for i in range(0, 1): # ???0?3?????i?
print('????' + str(i))
myscroll(driver)
time.sleep(2)
st=time.strftime("%Y%m%d",time.localtime())
# print(driver.page_source, file=open('itg201703.html', 'w', encoding='utf-8'))
print(driver.page_source, file=open(str_fname+"-"+st+".html", 'w', encoding='utf-8'))
print("?????????")
print(driver.title)
driver.quit()
评论列表
文章目录