# -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
import selenium
from selenium import webdriver
browser=webdriver.Firefox()
browser.get('https://www.baidu.com/')
linkElem=browser.find_element_by_link_text("hao123")
linkElem.click()
程序打开一个火狐浏览器,打开百度网页,随后找到hao123文字,点击,进入hao123页面
# -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
import selenium
from selenium import webdriver
browser=webdriver.Firefox()
browser.get('https://www.baidu.com/')
#linkElem=browser.find_element_by_link_text("hao123")
linkElem=browser.find_element_by_link_text("新闻")
linkElem.click()
支持中文点击,这是点击的百度新闻
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 22 17:14:23 2016
@author: Administrator
"""
import selenium
from selenium import webdriver
browser=webdriver.Firefox()
browser.get('http://down.foodmate.net/standard/down.php?auth=24398&node=2')
问题:访问下载地址,并没有直接下载,这说明Python启动的火狐和默认狐火不一样,看看加路径后是否能实现。