【Python_selenium】selenium模块_安装配置
简介
selenium 是一个用于Web应用程序测试的工具。
Selenium测试直接运行在浏览器中,就像真正的用户在操作一样。
支持的浏览器包括IE、Mozilla Firefox、Mozilla Suite等。
这个工具的主要功能包括:
测试与浏览器的兼容性——测试你的应用程序看是否能够很好得工作在不同浏览器和操作系统之上。
测试系统功能——创建衰退测试检验软件功能和用户需求。
支持自动录制动作和自动生成。Net、Java、Perl等不同语言的测试脚本。
Selenium 是ThoughtWorks专门为Web应用程序编写的一个验收测试工具
安装
pip install selenuim
引用
from selenium import webdriver
配置
把driver放在python的Scripts路径下,同时把script路径加入环境变量
谷歌驱动【chromedriver】下载地址:http://chromedriver.storage.googleapis.com/index.html
火狐历史版本下载地址: http://ftp.mozilla.org/pub/firefox/releases/
火狐驱动【geckodriver】下载地址: https://github.com/mozilla/geckodriver/releases
IE浏览器驱动【IEdriver】下载地址: http://dl.pconline.com.cn/download/771640-1.html http://www.nuget.org/packages/Selenium.WebDriver.IEDriver/
拓展
参考链接: https://www.cnblogs.com/hellosecretgarden/p/9206648.html
问题一:元素不可交互
selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable
可能原因,加延迟等待几秒在查找元素
time.sleep(5)
问题二:
-------------------------------------------------------------------------------------
如果万事开头难 那请结局一定圆满 @ Phoenixy
-------------------------------------------------------------------------------------
浙公网安备 33010602011771号