selenium+python初学者求教

fromseleniumimportwebdriverfromBaseScriptimport*fromselenium.webdriver.common.byimpor... from selenium import webdriver
from BaseScript import *
from selenium.webdriver.common.by import By

class PageObject(Base):
kw_loc = (By.ID, "kw")
su_loc = "id, 'su'"

def __init__(self, driver):
self.driver = driver
self.driver.get("http://www.baidu.com")

def find_po_element(self, text):
print(self.kw_loc)
# self.find_element(self.kw_loc).clear()
self.find_element(self.kw_loc).send_keys(text)
# print(page_object)

driver = webdriver.Ie()
PageObject = PageObject(driver)
PageObject.find_po_element("abc")
为啥执行的时候浏览器总是崩溃呢,求大神解答
展开
 我来答
兔子吃清草
2019-08-30 · TA获得超过2506个赞
知道大有可为答主
回答量:2807
采纳率:70%
帮助的人:424万
展开全部
selenium打开浏览器是需要驱动的。。。。你是不是没有去下载你的浏览器的驱动文件然后调用啊
我这里webdriver.Chrome(executable_path=executable_path, chrome_options=chrome_options)的executable_path就是chrome的驱动路径
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式