splinter操作ie浏览器

匿名 (未验证) 提交于 2019-12-02 23:49:02

splinter 是在selenium上的封装,很多操作更方便,但是默认似乎不能直接操作ie,通过修改browser.py文件,splinter\driver\webdriver下增加ie.py文件,可以直接操作ie浏览器。

环境:py3.7,win7,实测基本操作没问题,点击、查找元素、选择切换frames等。

  • 修改browser.py文件,添加两行:

from splinter.driver.webdriver.ie import WebDriver as IeWebDriver #添加
from splinter.exceptions import DriverNotFoundError


_DRIVERS = {
"firefox": FirefoxWebDriver,
"remote": RemoteWebDriver,
"chrome": ChromeWebDriver,

}

  • splinter\driver\webdriver下增加ie.py,在chrome.py基础上修改

github链接:https://github.com/chengair/SplinterforIe

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!