installing Autolit library - robotframework

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

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.

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

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

"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.

Related

How to import data file for a Windows executable file from R?

I am trying to run a Windows executable file from R. I have managed to open the executable file from R using the command:
system2('cmd', args=c('/c', '"C:/Program Files (x86)/UIFormModel.exe"'))
To run the executable file, I need to import an Excel file by clicking on the button “Load Settings File” (see figure below). Thus, the button is part of the executable file.
How can I do this from R ?
I have tried this command but it does not work:
system2('cmd', args=c('/c', '"C:/Program Files (x86)/UIFormModel.exe"', '"F:/template_LHS1.xlsx"'))
'C:/Program' is not recognized as an internal or external command,
operable program or batch file.
Warning message:
running command '"cmd" /c "C:/Program Files (x86)/UIFormModel.exe" "F:/template_LHS1.xlsx"' had status 1
Several points:
normally one does not have .exe files directly under C:\Program Files (X86) so first double check the path name. I suspect it is not as in the question but is something like the one shown below.
note the quoting used below
are you sure that the program accepts a command line argument as an alternative to its GUI? Can you run it from Windows cmd line? If not you could write an autohotkey (see AutoHotKey section below) or autoit script to control it and launch that from R.
if it does accept an argument ensure that the program allows forward slashes -- if not use backslashes
cmd line argument accepted
If the program accepts a command line argument then try this code:
system2("C:/Program Files (x86)/UIFormModel/UIFormModel.exe", "F:/template_LHS1.xlsx")
Another way is:
shell('"C:/Program Files (x86)/UIFormModel/UIFormModel.exe" F:/template_LHS1.xlsx')
For example, using the free CSVfix I was able to run the following and found that they worked:
system2("C:/Program Files (x86)/CSVfix/CSVfix.exe", "help")
shell('"C:/Program Files (x86)/CSVfix/CSVfix.exe" help')
See ?system2 and ?shell for other arguments you may wish to use.
AutoHotKey
If the program does not accept command line arguments then this sample AutoHotKey script launches WinMerge, a free file comparison GUI for Windows, comparing the WinMerge executable to itself. This has the effect of generating a popup warning and the AutoHotKey script dismisses that warning message by sending an Enter keystroke to the WinMerge window.
Be sure AutoHotKey and WinMerge are installed, that the script below is in a text file, test.ahk, in the current directory, the one given by getwd(), and then from the R console run:
shell("test.ahk")
Here is the test.ahk script:
exe = "C:\Program Files (x86)\winmerge\winmergeu.exe"
Run %exe% %exe% %exe%
WinWait WinMerge
; dismiss the dialog warning that both files are the same
Send {Enter}
If you go this route this script will need to be modified or rewritten in ways that will be specific to your program.
I've been trying several alternatives, but I've not successfully called an executable with a parameter. Nevertheless I can suggest a workaround using a .bat file:
system2("cmd.exe", input='"D:/workspace/execute.bat"')
Where execute.bat may contain something like:
C:/Program Files (x86)/UIFormModel.exe F:/template_LHS1.xlsx

Can not call 'make clean' in cmd regarding qmake project

I'm reading Foundations of Qt Development - by Johan Thelin.
Here quote from page 450 about Building QMake Project.
If you choose to create a Makefile using QMake, you can build your project using a simple make command (or nmake if you’re using Visual Studio). You can clean up your intermediate files using make clean. The slightly more brutal step is to run make distclean, which cleans up all generated files, including the Makefile. You will have to run QMake again to get a Makefile for make.
I tried hard to clean the files using 'make clean'. But cmd displaying the message 'make' is not recognized as an internal or external command, operable program or batch file.
I searched here and tried to find the PATH to make inside Qt directory. But not successful. Then according to this solution I tried to use mingw32-make also. But same results.
Anyone of you can help me?
If you using mingw32, try mingw32-make clean. Remember, you must add mingw's bin directory to User Enviroment to use this command. Follow "My Computer" > "Properties" > "Advanced" > "Environment Variables" > "Path" and add ;C:\Qt\Tools\mingw492_32\bin
OR
use command: setx PATH %PATH%;C:\Qt\Tools\mingw492_32\bin

CodeLite error while compiling library project

Im trying to compile static library project with CodeLite and getting error:
ar rcus ./Debug/libtestlib.a #"testlib.txt"
ar: #testlib.txt: No such file or directory
But i have file testlib.txt. When i inspect exported makefile i see:
$(AR) $(ArchiveOutputSwitch)$(OutputFile) #$(ObjectsFileList) $(ArLibs)
For me it is strange to see there # symbol near ObjectsFileList. How should i compile static library project in CodeLite ?
The #"testlib.txt" is a way of letting the linker (or ar in your case) to read the object list from a file and not from a command line, this is done because on some OS, there is a limitation on the input string that a program can accept from the command line.
Usually this is not a problem ( you did not mention what is your OS and CodeLite version ) but if it is a problem (like in your case), you can disable this from CodeLite's menu bar:
Settings -> Build Settings -> Compilers -> <Your Compiler Name> -> Advanced
and Uncheck the option:
"Pass object list to the linker via file" and your problems will be gone
FYI:
I only seen this error on OSX, is this the case here?
Eran

Cannot install AutoIT library for Robot Framework

I'm going to install AutoIT library for Robot framework to do automation task for Win Application, during on this, I've encountered a problem as below:
My OS : Win Vista 32-bits
1. Install Python 2.7.6 using Windows installer
2. Install Robot Framework using 'pip' command line
3. Run 'python setup.py install' from C:/temp/AutoItLibrary-1.1 (unzipped) by Administration permission.
The command line show error:
Don't think we need to unregister the old one...
%SYSTEMROOT%\system32\regsvr32.exe /S C:\Python27\Lib\site-packages\AutoItLibrary\lib\AutoItX3.dll
The system cannot find the path specified.
Traceback (most recent call last):
File "setup.py", line 70, in <module>
subprocess.check_call(cmd, shell=True)
File "C:\Python27\lib\subprocess.py", line 540, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '%SYSTEMROOT%\system32\regsvr32.exe /S C:\Python27\Lib\site-p
ackages\AutoItLibrary\lib\AutoItX3.dll' returned non-zero exit status 1
So, Does the version Autoit_1.1. match with Win Vista or not ? please help me figure out the issue.
In my case the problem was solved setting the missing environment variable HOMEDRIVE and run python setup.py install as administrator. My Python is installed in C:\Python27 so I need to set HOMEDRIVE to C:
Login as an Administrator to console and then install (case from win 8.1)
Try installing wheel before installing robotframework-autoitlibrary.
It worked like a charm.
pip install wheel
then
pip install robotframework-autoitlibrary
I solve the problem by the following steps:
1> go to
http://www.testingnotes.eu/howto-install-robot-framework-windows-7-8-64/
find the paragraph as below:
Download AutoIT library (64bits) from here:
AutoItLibrary-1.1_x64
8.1. Unzip “AutoItLibrary-1.1_x64” folder. (i.e. in this example I will unzip to “C:\”)
8.2. Open command shell as Administrator. Click on “Start”, type “cmd”, right click > “Run as Administrator“).
8.3. Go to AutoIT folder (i.e. in this example I had to type: “cd C:\AutoItLibrary-1.1_x64”
8.4. Run configuration script: type “setup.py install” and ENTER.
the key point is
8.2. Open command shell as Administrator. Click on “Start”, type “cmd”, right click > “Run as Administrator“).
2> just do it: Click on “Start”, type “cmd”, right click > “Run as Administrator“.
I am from China, before answer the question when I get the solution, I need to over the wall. It is not easy.
Remove everything under Python/AutoItLibrary folder:
..\Python36\Lib\site-packages\AutoItLibrary
and rerun python setup.py install
it will work.
run pip install robotframework-autoitlibrary as an admin.
I'll fix this problem by installing AutoIT on local computer (log to computer by local account) not member of domain(log with domain). And it's solved.

Eclipse Plugin- How to execute UNIX command from eclipse plugin?

I am writing an eclipse plugin that will take input of a file name, pass that to a UNIX command and get the output back (The command is to get file path of entered file name from CVS repository). My basic plugin code is under development, but I am not finding any info on how can I execute UNIX commands from eclipse. Any pointers would be helpful.
Runtime.exec(...) from the Java standard library should do what you need to execute UNIX shell commands that are in your path of the user that is executing eclipse. If you want to call UNIX C libraries API you can use the JNA library.

Resources