installing Autolit library

倾然丶 夕夏残阳落幕 提交于 2019-12-10 12:11:43

问题


I am writing robot tests for web testing using Google's Robot Framework with SeleniumLibrary (a test library) , one of my test involves uploading a file from the desktop by clicking on a"Browse" button on the webpage and using the windows file explorer window that pops up to navigate to and select the file ( providing a text path to file is disabled on the website for security reasons.) I have tried digging around but found little on automating this Windows File Explorer action , is there a way I can do this ?

After downloading the AutoIt library and trying to install it is asking for wincom32./python window extensions.And i am trying to install it is giving some error like

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()

回答1:


Below is a quick step to step guide to install autoit for robotframework in Windows (as what versions work with what in python is a pain):

First you will need a 32 bit python as autoit will not install for windows 64bit. I have used:

  • Python 2.6

Then from http://sourceforge.net/projects/pywin32/files/pywin32/Build%20217/ Download the windows installer so for python 2.6 it will be:

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

Now on the command prompt go to the location of where you downloaded the autoit files ex: - cd C:\Development\Downloaded files\AutoItLibrary-1.1 and then type - python setup.py install

If successful you will see lines in the cmd line such as:

 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-     

Now run the test C:\RobotFramework\Extensions\AutoItLibrary\tests

Note: Ensure you have the environment variables set correctly:i.e. - c:\python26 for python - c:\python26\scripts for pybot

You can now run your robotframework tests by creating an exe and calling - Run C:\RobotFramework\Seans Autoit Files\FF_FileUpload.exe

To find how to create the autoit exe visit the autoit website.




回答2:


Are you attempting to install the pywin32 extensions from source? There are windows installers for all flavours of windows so I would recommend you install using an installer.

(one other thing, google did not make robot framework. It was Nokia Siemens networks...)




回答3:


Use the Keyword 'Choose File'. No need for AutoIT Lib

Name: Choose File

Source: Selenium2Library

Arguments: [ locator | file_path ]

Inputs the file_path into file input field found by identifier. This keyword is most often used to input files into upload forms. The file specified with file_path must be available on the same host where the Selenium Server is running.

Example: Choose File my_upload_field C:\Automation\sample.csv




回答4:


"Choose File" worked in my case. Please note that in my case this made robot write the file path into the input field which was otherwise not editable manually.



来源:https://stackoverflow.com/questions/10748828/installing-autolit-library

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