Python selenium模拟浏览器
2018-02-21 21:30
447 查看
#! /usr/bin/env python
#coding:utf-8
from selenium import webdriver
import sys
import time
def get_html():
obj = webdriver.PhantomJS()
obj.set_page_load_timeout(5)
try:
obj.get('http://10.10.28.189/web/guest/cn/websys/jobList/jobListGetHistory.cgi')
try:
obj.find_element_by_class_name("defaultTableCommandButton").click()
except Exception as e:
print e
text = obj.page_source
obj.quit()
return text
except Exception as e:
print e
return ''
def save_file(data):
with open('Ricoh_Aficio_MP_301.html', 'w') as f:
f.write(str(data))
def main():
data = get_html()
save_file(data)
if __name__ == '__main__':
reload(sys)
sys.setdefaultencoding('utf-8')
#while True:
main()
#time.sleep(30*60)
#coding:utf-8
from selenium import webdriver
import sys
import time
def get_html():
obj = webdriver.PhantomJS()
obj.set_page_load_timeout(5)
try:
obj.get('http://10.10.28.189/web/guest/cn/websys/jobList/jobListGetHistory.cgi')
try:
obj.find_element_by_class_name("defaultTableCommandButton").click()
except Exception as e:
print e
text = obj.page_source
obj.quit()
return text
except Exception as e:
print e
return ''
def save_file(data):
with open('Ricoh_Aficio_MP_301.html', 'w') as f:
f.write(str(data))
def main():
data = get_html()
save_file(data)
if __name__ == '__main__':
reload(sys)
sys.setdefaultencoding('utf-8')
#while True:
main()
#time.sleep(30*60)
相关文章推荐
- Python2.7 淘宝爬虫selenium 模拟浏览器
- Python爬虫之selenium爬虫,模拟浏览器爬取天猫信息
- 【Python】 Selenium 模拟浏览器 寻路
- 浅谈python爬虫使用Selenium模拟浏览器行为
- python+Selenium2+chrome构建浏览器模拟环境
- python selenium 模拟手机浏览器
- python+chrome+Selenium模拟手机浏览器
- Python爬虫实战03:用Selenium模拟浏览器爬取淘宝美食
- python爬虫:使用Selenium模拟浏览器行为
- Python利用selenium模拟浏览器抓取异步加载等难爬页面信息
- python+selenium模拟浏览器登录shibboleth登录的模拟
- python+chrome+Selenium模拟手机浏览器
- Python使用Selenium模块实现模拟浏览器抓取淘宝商品美食信息功能示例
- python 针对selenium+phontomjs等模拟浏览器爬虫的反爬技术点
- 使用python利器selenium工具模拟浏览器运行并爬取淘宝商品信息
- Python使用Selenium模块模拟浏览器抓取斗鱼直播间信息示例
- python+chrome+Selenium模拟手机浏览器
- Selenium 模拟浏览器
- python模拟浏览器登陆人人网站
- selenium模拟fireFox浏览器,爬取网页信息