【问题标题】:installing Autolit library安装 Autolit 库
【发布时间】:2012-05-31 16:57:11
【问题描述】:

我正在使用带有 SeleniumLibrary(测试库)的 Google 机器人框架编写用于 Web 测试的机器人测试,我的一项测试涉及通过单击网页上的“浏览”按钮并使用 windows 文件从桌面上传文件弹出以导航到并选择文件的资源管理器窗口(出于安全原因,网站上禁用了提供文件的文本路径。)我尝试过四处挖掘,但在自动执行此 Windows 文件资源管理器操作时发现很少,有没有办法我可以吗?

下载 AutoIt 库并尝试安装后,它要求 wincom32./python 窗口扩展。而我尝试安装它却给出了一些错误,例如

Building pywin32 2.7.217.0    
Trace-back (most recent call last):    
  File "setup.py", line1944, in <module>
      """ % dirs).split(),    
  File "setup.py", line 603,    in __init__
      if os.path.isfile(os.path.join(sdk_dir, "include", "activdbg.h")):    
  File"C:\Python27\lib\ntpath.py", line 96 in join
      assert len(path) > 0    
  TypeError: object of type 'NoneType' has no len()

【问题讨论】:

    标签: robotframework


    【解决方案1】:

    以下是在 Windows 中为机器人框架安装 autoit 的快速分步指南(因为哪些版本适用于 python 中的哪些内容很痛苦):

    首先你需要一个 32 位的 python,因为 autoit 不会安装在 64 位的 windows 上。我用过:

    • Python 2.6

    然后来自http://sourceforge.net/projects/pywin32/files/pywin32/Build%20217/ 下载 windows 安装程序,因此对于 python 2.6 它将是:

    • pywin32-217.win32-py2.6.exe

    现在在命令提示符下转到您下载 autoit 文件的位置,例如: - cd C:\开发\下载的文件\AutoItLibrary-1.1 然后输入 - python setup.py 安装

    如果成功,您将在 cmd 行中看到如下行:

     Generating...
     Importing module
     running install
     running build
     running build_py
     creating build
     creating build\lib
     creating build\lib\AutoItLibrary
     copying src\AutoItLibrary\Counter.py -> build\lib\AutoItLibrary
     copying src\AutoItLibrary\Logger.py -> build\lib\AutoItLibrary
     copying src\AutoItLibrary\__init__.py -> build\lib\AutoItLibrary
     running install_lib
     copying build\lib\AutoItLibrary\Counter.py -> C:\Python26\Lib\site-     packages\AutoItLibrary
     copying build\lib\AutoItLibrary\Logger.py -> C:\Python26\Lib\site-     
    

    现在运行测试 C:\RobotFramework\Extensions\AutoItLibrary\tests

    注意:确保您已正确设置环境变量:即 - c:\python26 用于 python - c:\python26\pybot 的脚本

    您现在可以通过创建 exe 并调用 - 运行 C:\RobotFramework\Seas Autoit Files\FF_FileUpload.exe

    要了解如何创建 autoit exe,请访问 autoit 网站。

    【讨论】:

      【解决方案2】:

      您是否尝试从源代码安装 pywin32 扩展?有适用于所有类型 Windows 的 Windows 安装程序,因此我建议您使用安装程序进行安装。

      (另外一件事,谷歌没有做机器人框架。它是诺基亚西门子网络......)

      【讨论】:

        【解决方案3】:

        使用关键字“选择文件”。无需 AutoIT Lib

        名称:选择文件

        来源:Selenium2Library

        参数:[ 定位符 |文件路径]

        file_path 输入到identifier 找到的文件输入字段中。 此关键字最常用于将文件输入到上传表单中。使用file_path 指定的文件必须在运行 Selenium 服务器的同一主机上可用。

        示例:选择文件 my_upload_field C:\Automation\sample.csv

        【讨论】:

          【解决方案4】:

          “选择文件”在我的情况下有效。请注意,在我的情况下,这使得机器人将文件路径写入输入字段,否则无法手动编辑。

          【讨论】:

            猜你喜欢
            • 2011-03-01
            • 2015-03-16
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 2017-02-20
            • 2021-02-01
            相关资源
            最近更新 更多