python一直提示“str”object has no attribute 'find_element_by_id'怎么办
import colorsys
import urllib,os,uuid,re,time
from PIL import Image
from selenium.webdriver.common.action_chains import ActionChains
from selenium import webdriver
from StringIO import StringIO
wzj="res"
def openBrowser():#001_2
#global wzj
wzj = webdriver.Firefox()#打开火狐浏览器
#http://bj.gsxt.gov.cn/sydq/loginSydqAction!sydq.dhtml
wzj.get('http://bj.gsxt.gov.cn/sydq/loginSydqAction!sydq.dhtml')
image1_url = wzj.find_elements_by_class_name('gt_cut_bg_slice')[0].get_attribute('style')#获得图片的样式
image1_url=image1_url[23:-38]#1照片URL地址
image2_url = wzj.find_elements_by_class_name('gt_cut_fullbg_slice')[0].get_attribute('style')
image2_url=image2_url[23:-38]#2照片url地址
return [image1_url,image2_url]
def create(locapath,fileName):#001_1
filePath=locapath+'/'+fileName
if not os.path.exists(filePath):
file=open(filePath,'a+')#在网站上下载的时候写入的地址
file.close()
return filePath
def downloadImg(): #001
list = openBrowser()
for i in range(2):#range是一个创建整数列表range(2)代表是从0到2
fileName=str(i)+'_test.jpg'
urllib.urlretrieve(list[i],create('C:/Users/admin/Desktop/', fileName)) #下载到本地
time.sleep(3)
def inputbyid(): #001_3
#输入查询关键词
#:text: Unicode, 要输入的文本
#:element_id: 输入框网页元素id
#keyword_qycx
text=u"百度"
element_id="keyword_qycx"
input_el =wzj.find_element_by_id(element_id)
input_el.clear()
input_el.send_keys(text)
time.sleep(3.5)
def clickbyid(): #001_4
#点击查询按钮
#:element_id: 查询按钮网页元素id
#popup-submit
element_id01="popup-submit"
wzj.find_element_by_id(element_id01).click()
time.sleep(3.5)