zoukankan      html  css  js  c++  java
  • Robot Framework -004 为了进行Web测试,安装SeleniumLibrary外部库

    链接地址: https://github.com/robotframework/SeleniumLibrary/

    简介

    SeleniumLibrary是用于Robot Framework的Web测试库,该库在内部使用Selenium工具。 该项目托管在GitHub上,可以从PyPI找到下载。

    SeleniumLibrary可与Selenium 3和4一起使用。它支持Python 2.7以及Python 3.6或更高版本。 除了常规的Python解释器外,它还可以与PyPy和Jython一起使用。 不幸的是,IronPython当前不支持Selenium,因此该库也不适用于IronPython。

    SeleniumLibrary基于旧的SeleniumLibrary,该旧SeleniumLibrary被分支到Selenium2Library,随后又重命名回SeleniumLibrary。 有关不同版本和整个项目历史记录的更多信息,请参见下面的“版本和历史记录”部分。

    历史变迁

    SeleniumLibrary最初使用Selenium远程控制器(RC)API。当Selenium 2与新的但向后不兼容的WebDriver API一起引入时,使用Selenium RC保留了SeleniumLibrary,而使用WebDriver分离了Selenium2Library。这些项目包含大多数相同的关键字,并且在大多数情况下,Selenium2Library可以替代SeleniumLibrary。

    多年来,旧的SeleniumLibrary的开发停止了,并且不赞成使用它使用的Selenium RC API。 Selenium2Library被进一步开发,并取代了旧的库,成为了Robot Framework的事实上的Web测试库。

    当Selenium 3于2016年发布时,它在其他方面与Selenium 2向后兼容,但已删除了不推荐使用的Selenium RC API。这有两个重要影响:

    旧的SeleniumLibrary不能再与新的Selenium版本一起使用。这个项目几乎已经死了。
    Selenium2Library的名称不好,因为它支持Selenium 3很好。该项目需要一个新名称。
    在发布Selenium 3的同时,Selenium2Library正在进行较大的体系结构更改,以简化将来的维护并使添加Python 3支持更加容易。在进行了所有这些内部和外部的重大更改之后,将Selenium2Library重命名为SeleniumLibrary才有意义。该决定基本上意味着以下更改:

    自Selenium2Library被派生以来,为旧的SeleniumLibrary创建单独的存储库以保留其历史记录。
    将Selenium2Library项目和库本身重命名为SeleniumLibrary。
    添加新的Selenium2Library项目,以简化从Selenium2Library到SeleniumLibrary的过渡。
    展望未来,所有新开发都将在新的SeleniumLibrary项目中进行。

    综上所述:SeleniumLibrary 是目前正在维护的版本,Selenium2Library属于旧版本了。

    安装

    pip install --upgrade robotframework-seleniumlibrary

    Collecting robotframework-seleniumlibrary
    Using cached robotframework_seleniumlibrary-4.4.0-py2.py3-none-any.whl (92 kB)
    Collecting selenium>=3.141.0
    Using cached selenium-3.141.0-py2.py3-none-any.whl (904 kB)
    Requirement already satisfied, skipping upgrade: robotframework>=3.1.2 in d:0_softpython36-32libsite-packages (from robotframework-seleniumlibrary) (3.2)
    Collecting urllib3
    Using cached urllib3-1.25.9-py2.py3-none-any.whl (126 kB)
    Could not build wheels for robotframework, since package 'wheel' is not installed.
    Installing collected packages: urllib3, selenium, robotframework-seleniumlibrary
    Successfully installed robotframework-seleniumlibrary-4.4.0 selenium-3.141.0 urllib3-1.25.9

    pip list

    Package Version
    ------------------------------ -------
    pip 20.1
    robotframework 3.2
    robotframework-seleniumlibrary 4.4.0
    selenium 3.141.0
    setuptools 40.6.2
    urllib3 1.25.9

    另外还需要安装浏览器驱动  网址: https://github.com/robotframework/SeleniumLibrary/#browser-drivers

    本文主要使用chrome浏览器,其驱动的下载地址是:https://chromedriver.chromium.org/

    先查看自己Chrome浏览器的版本,我的版本是81,则选择支持81版本的对应驱动:

    下载后得到文件: chromedriver_win32 .zip  解压缩之后得到文件: chromedriver.exe ,将其复制到Python目录。

  • 相关阅读:
    Time Zone 【模拟时区转换】(HDU暑假2018多校第一场)
    HDU 1281 棋盘游戏 【二分图最大匹配】
    Codeforces Round #527 (Div. 3) F. Tree with Maximum Cost 【DFS换根 || 树形dp】
    Codeforces Round #527 (Div. 3) D2. Great Vova Wall (Version 2) 【思维】
    Codeforces Round #527 (Div. 3) D1. Great Vova Wall (Version 1) 【思维】
    Codeforces Round #528 (Div. 2, based on Technocup 2019 Elimination Round 4) C. Connect Three 【模拟】
    Avito Cool Challenge 2018 E. Missing Numbers 【枚举】
    Avito Cool Challenge 2018 C. Colorful Bricks 【排列组合】
    005 如何分析问题框架
    004 如何定义和澄清问题
  • 原文地址:https://www.cnblogs.com/abc789/p/12815015.html
Copyright © 2011-2022 走看看