AutoItLibrary not work on Jenkins

1,387 views
Skip to first unread message

Phuoc Ha

unread,
Jul 2, 2015, 3:39:46 AM7/2/15
to robotframe...@googlegroups.com
Hi guys,

I need to upload an image and I'm using AutoitLibrary now.
It's working when I run script by RIDE, but when I run by Jenkins, seem Autoit not working
Any body work with autoit before?
Please help, thanks so much!

So this is my source for case upload. It's working correctly by RIDE

*** Settings ***
Library           Selenium2Library
Library           AutoItLibrary

*** Variables ***
${dir_receipts_default_folder}    ${CURDIR}\\..\\data_test\\receipt    # Default receipt folder
${global_flag_receipt}    False

*** Keywords ***
Choose File To Upload From Windows Dialog
    [Arguments]    ${dir_upload_receipts}    ${receipt_name}
    Sleep    1s
    ${value}    Run Keyword And Return Status    Control Focus    File Upload    ${EMPTY}    Edit1    # Focus upload windows
    Run Keyword If    '${value}'=='False'    Fail    Failed HERE.
    Sleep    500ms
    Run Keyword If    '${dir_upload_receipts.lower()}'=='default'    Control Set Text    File Upload    ${EMPTY}    Edit1    ${dir_receipts_default_folder}\\${receipt_name}
    ...    ELSE IF    '${dir_upload_receipts.lower()}'<>'${EMPTY}'    Control Set Text    File Upload    ${EMPTY}    Edit1
    ...    ${dir_upload_receipts}\\${receipt_name}    ELSE    Log    Unattached expense receipt
        Sleep    500ms
    Control Click    File Upload    ${EMPTY}    Button1    ${EMPTY}    # Click Button Open
    Sleep    500ms

Best regards,
PhuocHa.

David

unread,
Jul 3, 2015, 1:04:24 AM7/3/15
to robotframe...@googlegroups.com
Where does Jenkins run this from or run against? Bear in mind AutoIt needs to run "locally" on Windows machine you are testing. That means the Jenkins slave/agent that executes this must be a Windows machine running the test (locally). If it's ever remote, like Jenkins test executor is Linux, and you're targeting a remote Windows machine, you'll need to patch how you run AutoItLibrary:

* the simplest case is to use (Python) remote server to run/load AutoItLibrary on the Windows machine, you then load that remote server connection in your RF tests.

the other alternative is to use like PSExec.exe, SSH, etc. but that doesn't blend well with AutoItLibrary, that's more for connecting to AutoIt tool remotely with other frameworks rather than AutoItLibrary and RF.

Phuoc Ha

unread,
Jul 3, 2015, 6:26:05 AM7/3/15
to robotframe...@googlegroups.com
Hi David,

Did you mean that I should create remote library like this?
https://groups.google.com/forum/#!topic/robotframework-users/Dd8l13mmXLc
I've tried to create python file: myRemoteServer.py

import sys
sys
.path.append('C:\\Python27\\Lib\\site-packages\\robot\\libraries')
import OperatingSystem
import AutoItLibrary
from robot.libraries.OperatingSystem import OperatingSystem
from AutoItLibrary import AutoItLibrary
 
class myRemoteServer(OperatingSystem, AutoItLibrary):

   
def __init__(self):
       
OperatingSystem.__init__(self)
       
AutoItLibrary.__init__(self)

if __name__ == '__main__':
   
from robotremoteserver import RobotRemoteServer
   
RobotRemoteServer(myRemoteServer(), *sys.argv[1:])



So I tried to compile, but failed
Please help me how to use remote server

Thanks David,

Vào 12:04:24 UTC+7 Thứ Sáu, ngày 03 tháng 7 năm 2015, David đã viết:

David

unread,
Jul 3, 2015, 7:44:50 PM7/3/15
to robotframe...@googlegroups.com
Yes, hopefully that thread post can help you. What failure message do you get?

Keep in mind that you will be running the remote server on the Windows machine, which I assume is likely not the Jenkins machine running the tests. In such case, it is easiest to have RF and AutoItLibrary installed on the Windows machine as well, even though the tests don't run directly on it. This allows all the necessary file/library dependencies to exist on Windows so that you can load/run AutoIt on the remote server there.

I've never had to deal with this myself, so am not aware of any general issues with AutoItLibrary run remotely. Hopefully others here can help chime in.

Phuoc Ha

unread,
Jul 5, 2015, 9:35:13 PM7/5/15
to robotframe...@googlegroups.com
Hi David,

Thanks you for your help.
So I'm using autoit for robot framework with upload case, but Autoit just working on Windows machine.
Do you know how to upload both of machines Windows & LINUX ?

Regards,
Phuoc Ha

Vào 06:44:50 UTC+7 Thứ Bảy, ngày 04 tháng 7 năm 2015, David đã viết:

David

unread,
Jul 6, 2015, 10:32:57 PM7/6/15
to robotframe...@googlegroups.com
AutoIt will only run (locally) against a Windows machine to do any GUI manipulation like file upload. It doesn't support Linux GUI manipulation. You can however run code that relates to AutoIt remotely on Linux (like RF on Linux calling remote server with AutoItLibrary running on Windows).

For Linux (and Windows combined) support, you'll need to look elsewhere. Some suggestions:

Sikuli

I don't know if there's any RF integration/library for this already

LDTP
I don't know if there's any RF integration/library for this already

but if you're doing browser based file upload (not file upload for some desktop GUI app), it should work fine via Selenium2Library (or older SeleniumLibrary) if you use the right supported browsers. I would assume FF and Chrome would likely work. Unless that's a missing feature in those libraries or some bug w/ FF/Chrome driver on Linux. So if it should be fine w/ Selenium, you won't need AutoIt or the other tools, and it would work remotely via RemoteWebDriver connection or Selenium Grid.

Phuoc Ha

unread,
Jul 7, 2015, 10:09:25 PM7/7/15
to robotframe...@googlegroups.com
yeah that is a good solution David
I will try to use sikuli framework
Thanks you very much!

Regards,
Phuoc Ha.


Vào 09:32:57 UTC+7 Thứ Ba, ngày 07 tháng 7 năm 2015, David đã viết:

mani deep

unread,
Mar 23, 2018, 9:26:38 AM3/23/18
to robotframework-users
Is your issue resolved..I am facing an issue when using Jenkins+autoit combination with Selenium. Jenkins is configured in different window machine over there it is opening browser and runing my test cases fine. But for file upload(with autoit) i am not able to upload file till i connect to Jenkin's windows server remotely(with remote desktop). Do we need to configure anything for my Jenkins node? or any other way? i hope there is no issue in my autoit code as it is working fine in my local machine and even working fine if i login to server remotely and trigger jenkins build from different machine.
Reply all
Reply to author
Forward
0 new messages