selenium3环境搭建以及各浏览器驱动的使用方法

时间:2023-03-08 16:12:23
selenium3环境搭建以及各浏览器驱动的使用方法

想了解更多关于seleniu请访问selenium官网 https://www.seleniumhq.org/

以Selenium3.0.2版本为例介绍在Python中如何安装及使用,具体操作步骤如下:

1.在Python中安装WebDriver

方法一:使用pip工具安装

安装好python,pip工具后,先尝试在cmd下安装selenium,在cmd下直接输入命令"pip install selenium",此时默认下载的是最新版本的selenium

如果想下载指定版本的selenium,可使用命令"pip install selenium==3.0.2"进行下载,具体操作如下:

      aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAXUAAAB1CAIAAAA+6OYrAAAR/klEQVR4Ae1du24c2REdLQTHIjNn4k7gmJK1gZ0IoAnDkRMyd0QYMAz4T2zYMGwwcr5MHAsDbGIHFiR+AUV9Ack/WJ+e4hwW6z76Md0zfJwJZuuee+pU3dPN2p6hVvvixx9/nOklB+SAHJjAgW8m0JSkHJADcqBxQPNF94EckANTOaD5MpWz0pUDckDzRfeAHJADUzmg+TKVs9KVA3LgZcmCv/ztn6WtLP6nP/4+iwuUA3Lg2TpQnC9w5Fe//k3Jl7//699/+N1v+f6zn/6kxDT8cnH64WL33fHR/k6R2HCuc5TLxdnNmybz+vzs+49XXmB+eHKwN8tsONJd2abCzDKa/Ubu6u1SwNEVygE5MJYDL0p//gXPL7/8xXcdy/znv/8rP79wbtzc//G+p20/+se7nzI/8X6+fH511AyU5QvzwS/v6WUWYTrN5/OLi4s73u67k6P9u6UiOSAH1nag9vzy3c/fdtT/81//kWPaTzSeMU6WI2Hn4OQEc+T0w+1TxyplSdux54q94/Oz07MbPug0c6cZAhenH+eHx7uziw+nbibM5ocrkbZ/Xp8vPjY1bm5nUlMUzzLffjn98q0eYdrc074cGORAbb4MErxNWs4FfDI5frf4/t5IAHby6jOHzJLXTKBX52dn5wf4FLR/dPIaM+bUBs4eZtK3d5+PPvnRhBHxuWuPl58v5sdHzZg7gtz5q7dXt+u945uzxeUeH4q6CoonB+RAqwP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aBvFSBzSciKcHf9gPomxYN4nGClXMo3BLncok6KQNnAwPHpvjppHlTcOEBz+9qRJgaESwZWgksGAbeuuJsGKd9SDOc7EwO/gvstxgyCDgshCJzsFjikMSAzixBkQH4pSJlAPMiYgUnVl+B4go+z6WwvZXIrBIHJJYNsobALTkC4RMC4QmNXnuz5xNOAuQrMgW8GG1Ga5a2CHYc9aQyCcsCx5PUOTFsG/qQciqMlX5cxgnq3oeeOfNYNAesG3C9bOSR06dwrD4tZblh6NmsKzWwhgebAJj4f4aL6O9JfY4+3XpKKTja3Lz8rAnCwDk6H3JLs1vEB57LrFRLHOkiQ9db1uk/QT1/+WEeQTnDgpV3UcC39MiT4ZZrrd33sBXHtuWTgyZXY872OpWA3gHV+pVDYGqATOgmCD2TZ61wbOFGpH493sa4vv4umOAMciJ+P0nsICF4DpJnSMb2V1kpgRQu68MfipKWztzjLIcgSUh2epQs/pNeXbKYvrWNiXTbd7SjbkUb9vnwm+mAUES/4TOIXdk7al97EtpXiTPRb1MEucQ96HLHfMr5HKuSwhaW9kN6rLsjZigRLhFXBfF324GnWmyl7AmsZmVslvtf0cVaHoMn6JeNQl5pGYD/AiTAgyCzyjZPiREJQ4futLvopn0gvH3wWY2sbOoZYwK7CobRc14Hg+7pya+dvrB9fyMelE3Th+Ny+fJ+rWA48BAfi56OH0NMj6gEjwF6t//oCDeey9y4H7MvvoimOHJADckAOyAE5IAfkgByQA3JADsgBOSAH5IAckANyQA7IATkgB+SAHJADckAOyAE5IAfkgByQA3JADsgBOSAH5IAckANyQA7IATkgB+SAHJADckAOyAE5IAfkgByQA3JADsgBOSAH5IAckANyQA7IATkgB+SAHJADckAOyAE5IAfkgByQA3JADsgBOSAH5IAckANyQA7IATkgB+SAHJADckAOyAE5IAfkgByQA3JADsiBZ+rA/wH7O98A1u7s6AAAAABJRU5ErkJggg==" alt="" />
方法二:下载Selenium离线安装包进行安装
    下载地址https://pypi.python.org/pypi/selenium,你可以从pypi网站找到所有你所需要的selenium版本,以及对应版本所支持的python版本
    下载安装包并解压,cmd下通过cd命令进入到安装包setup.py目录,然后cmd下执行"python setup.py install"命令进行安装。
    验证安装结果:安装成功后进入python交互模式,执行"import selenium" ,如果没有报错说明selenium已经安装成功;
                            也可以使用pip工具查看已安装的版本以及详细信息,如下图所示:               
                            aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZcAAADACAIAAABH+LmhAAAe/klEQVR4Ae1dPa8sV7XEV+cPkFhCfDm3EyQSMn6CJZAjECkIASkBQoK/gBARySOzCJyQImfgiCfL6ImI55eQQQ7Jq3sX1Km79sfs3R8z3TM1QXvt2rVqrV3dvU/PzPG5n/nMq9fbb78dgY92wA7YgXM58OJc7bpbO2AH7EBywLtYMsRDO2AHTuaAd7GTnTC3awfsQHLAu1gyxEM7YAdO5oB3sZOdMLdrB+xAcsC7WDLEQztgB07mgHexk50wt2sH7EBywLtYMsRDO2AHzubA3/72t08//fT9999f0PiHH364IGu/lKP1s99KrWwH7AAdeGIUQdoIvv71ryeCDjELfuJQIfA01PTN42o/m1fpCMZiaUhpTic3ppLCRf4dEBa4VK76AX0rTXhY5LV3lHE94SaM1zJTkIvEODLgcJnmSbOw6ri7jtA/OjlOM2HIAVs6wplyD7MO5Gex2Xzz1YFys46NrMQ1S+NxpmaNxNHJCPNqnFjsJnvrfr5dzQ0XWuzA87MYLqZ0KaRh9ScnOJtchYsXkBKP1g/aO2BLyTQP7cCpHbj2s1ja8nCHh32KB0hEd4EqHwrEWyeDakGgJhODoDhTyEEuQeqwIqeUTxpmAw8aYgZ9BdIYkN8JgkyCtsSpKoiUwFmuDChbBhSPKZZQnGCZTqTkpzbApA7JRDBLfmhySDJrqZSCjk/jAL+jrJ7dkWWUiQnhkEHIcsgg4RhiCq+EE0l4dQiwxe/gOsWYQatQWSuYiQ8dSjEgs4oQZEB+GSQOhwgYI4sxg5CKoYKMGZRFVVB1OniixbDDR3VtQOMyq0TI7wTswcGJHHh+R7m4afwA5GUxJaI/OTuJpDFI5IRj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览器驱动的使用方法
   selenium3.x版本开始不再提供默认浏览器支持,所有浏览器都是通过各个浏览器官方提供相应的浏览器驱动进行支持,这使得运行在各种浏览器上的自动化测试更稳定。
   注意事项:
      1.下载的版本和浏览器位数,取决于你使用的操作系统的类型和位数(64bit或32bit),虽然浏览器的版本位数和操作系统的位数没有映射关系,但是为了防止出现驱动
         浏览器的问题,建议尽量保持版本一致。
      2. 浏览器的版本和驱动版本存在映射关系,下载使用时需注意,如果两个版本不匹配selenium将无法驱动浏览器
    以下提供了各浏览器的下载和驱动的下载地址:
      chromedriver与chrome版本映射表: https://blog.csdn.net/huilan_same/article/details/51896672
      下载chrome浏览器地址:https://google_chrome.en.downloadastro.com/old_versions/
      下载chrome浏览器驱动地址:http://chromedriver.storage.googleapis.com/index.html   
      下载firefox浏览器地址: http://ftp.mozilla.org/pub/firefox/releases/
      下载firefox浏览器驱动地址: https://github.com/mozilla/geckodriver/releases/
      下载IE浏览器地址:请自行下载
      下载IE浏览器驱动地址:请自行下载
3.使用三种浏览器编写webdriver脚本 
示例代码:Demo.py
#encoding=utf-8
from selenium import webdriver
import time
#使用webdriver驱动浏览器程序
#通过executable_path指明浏览器驱动文件所在路径
# driver=webdriver.Ie(executable_path="d:\\IEDriverServer") #以下均把浏览器驱动文件放进python安装程序的Scripts路径下
# driver=webdriver.Ie()
# driver=webdriver.Firefox()
driver=webdriver.Chrome()
#打开搜狗首页
driver.get("http://www.sogou.com")
#清空搜索框缓存内容
driver.find_element_by_id("query").clear()
#在搜索输入框中输入“光荣之路自动化测试”
driver.find_element_by_id("query").send_keys(u"自动化测试")
#单击搜索按钮
driver.find_element_by_id("stb").click()
#等待5秒,以便查看结果
time.sleep()
#退出浏览器
driver.quit()