python爬虫由浅入深11---selenium的基础与使用
2017-09-29 12:48
531 查看
百度百科说:
此处采用firefox浏览器(应首先安装对应的webdriver,并将其放在python.exe同一路径下)
bowser = webdriver.Firefox()
bowser.get("https://www.taobao.comm")
print(bowser.page_source)
browser.close()
此处采用firefox浏览器(应首先安装对应的webdriver,并将其放在python.exe同一路径下)
声明浏览器对象,访问页面
from selenium import webdriverbowser = webdriver.Firefox()
bowser.get("https://www.taobao.comm")
print(bowser.page_source)
browser.close()
查找元素
单个元素from selenium import webdriver browser = webdriver.Firefox() browser.get("https://www.taobao.com") input_first = browser.find_element_by_id('q') input_second = browser.find_element_by_css_selector('#q') input_third = browser.find_element_by_xpath('//*[@id="q"]') print(input_first,input_second,input_third)browser.close()
相关文章推荐
- Python 爬虫基础Selenium库的使用(二十二01)
- python爬虫由浅入深10---pyquery库的基础与使用
- python爬虫由浅入深8---正则表达式及Re库的基础与使用
- Python的Urllib库的使用(爬虫基础)
- 零基础写python爬虫之使用Scrapy框架编写爬虫
- 使用python+selenium制作浏览器爬虫,彻底解决ajax异步加载问题(待更新)
- 零基础写python爬虫之使用Scrapy框架编写爬虫
- 零基础写python爬虫之urllib2使用指南
- python3 [爬虫入门实战] 爬虫之使用selenium 爬取百度招聘内容并存mongodb
- python3 [爬虫实战] 微博爬虫京东客服之Selenium + Chrom浏览器的使用(上)
- Python爬虫学习(11):Beautiful Soup的使用
- python爬虫的最佳实践(五)--selenium+PhantomJS的简单使用
- 零基础写python爬虫之使用urllib2组件抓取网页内容
- python爬虫主要就是五个模块:爬虫启动入口模块,URL管理器存放已经爬虫的URL和待爬虫URL列表,html下载器,html解析器,html输出器 同时可以掌握到urllib2的使用、bs4(BeautifulSoup)页面解析器、re正则表达式、urlparse、python基础知识回顾(set集合操作)等相关内容。
- python爬虫积累(一)--------selenium+python+PhantomJS的使用
- python爬虫,selenium使用,Firefox-chrome-IE问题解决方法,selenium的基本操作
- 零基础写python爬虫之使用Scrapy框架编写爬虫
- Python爬虫学习——使用selenium和phantomjs爬取js动态加载的网页
- 零基础写python爬虫之使用Scrapy框架编写爬虫
- python3 [爬虫入门实战]爬虫之selenium 安装设置与初步使用