PYAutoGUI FAILSAFE problem when using ImageHorizonLibrary

1,847 views
Skip to first unread message

jjvay...@gmail.com

unread,
Mar 28, 2017, 6:28:22 AM3/28/17
to robotframework-users
Hi, I downloaded ImageHorizonLibrary because wanted to use keyboard in test. (I dont know how to use S2L keyword Press key). 

Using ImageHorizonLibrary's keyword Press Combination works fine when executing test straight from the RIDE.

Problem comes when executing same test in Selenium Grid node-machine controlled by Jenkins. Test fails every time to the first Press Combination keyword and the error message is:

FailSafeException: PyAutoGUI fail-safe triggered from mouse moving to upper-left corner. To disable this fail-safe, set pyautogui.FAILSAFE to False. I know that ImageHorizonlibrary uses PYAutoGUI and I understand the fail-safe function. The problem is that althought I have set FAILSAFE to False the error keeps coming. I have set it to false from command prompt before executing test like this: >>>import pyautogui >>>pyautogui.FAILSAFE = False But not working, so where is the right place to set it to False? -Jukka

Tatu Aalto

unread,
Mar 28, 2017, 12:42:07 PM3/28/17
to jjvay...@gmail.com, robotframework-users
Ugh

As a quick look, your browser is running in a another machine (maybe even in one of those could providers like SauceLabs) when it's executed by Jenkins? If yes, then you might have a problem. The remote functionality which is inbuilt to the selenium and therefore is available also from the Selenium2Library is not standard functionality in all other libraries. There are exceptions, like database or rest API libraries which have inbuilt remote functionality but as said it's not a standard functionality out of the box.

And ImageHorizonLibrary us one of those libraries which do not have that functionality in build. How to solve the problem is a more interesting problem, but unfortunately there is not a silver bullet to solve the problem. It depends how extensively​ you use ImageHorizonLibrary or other libraries. If you use it only a little, it might be easier to keep the functionality as is, but restric the those tests to run in a machine where there is a local browser available. If you are using the ImageHorizonLibrary in many places and limiting your test runs is not a valid option, then I would perhaps look in to the Robot Framework Remote interface direction: http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#remote-library-interface

-Tatu
Send from my mobile


--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsubscrib...@googlegroups.com.
To post to this group, send email to robotframework-users@googlegroups.com.
Visit this group at https://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/d/optout.


David

unread,
Mar 28, 2017, 7:05:55 PM3/28/17
to robotframework-users, jjvay...@gmail.com
For remote/distributed testing/deployment, what Tatu suggested about remote library interface is good. The other option is to use Selenium WebDriver API (around the tooling, e.g. ImageHorizonLibrary/pyAutoGUI) and hook into Selenium Grid with that to offer a scalable remote interface across nodes. Both options however, do not support nodes that you can't run custom software on (e.g. SauceLabs, etc.) only on nodes where you have control like an internal Selenium Grid setup.

For remote library interface, the easy approach is to run python remote server to serve ImageHorizonLibrary, but you'll need to know which node the browser test runs on so you can run this on same node. Here's a sample tip on how to figure out what node a selenium grid test runs on: https://gist.github.com/krmahadevan/1766772

For Selenium WebDriver API approach, one could make a port/wrapper for pyAutoGUI in the same way I did this for AutoPy: https://github.com/daluu/autopydriverserver. One then just hooks that up to Selenium Grid for that support via tips like the comments for this GH issue: https://github.com/daluu/AutoItDriverServer/issues/7#issuecomment-170838081
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsub...@googlegroups.com.
To post to this group, send email to robotframe...@googlegroups.com.

Jukka Väyrynen

unread,
Mar 29, 2017, 4:06:50 AM3/29/17
to robotframework-users
Thanks for advising. Yeah my browser is running on different machine, but I am not using Saucelab.

It is very nice to know that all libraries does not have remote functionality. I spent quite many hours trying to solve this issue. 

Now need to explore the solutions/links you gave me.


Ps. Can you provide any link or guide which tells how to use Selenium2Library keyword Press key?

Thanks Jukka

Tatu Aalto

unread,
Mar 29, 2017, 4:37:27 AM3/29/17
to jjvay...@gmail.com, robotframework-users
Ugh

When reading what Bryan write, I would explore that route first (assuming that limiting the test runs is not a valid option). Thanks for the tips Bryan, I might have similar problems soonnish.

Because the remote functionality is not out of the box solution, it's best to assume that libraries do not support it. And only assume support if it's explicitly mentioned that the library had support for it.

-Tatu
Send from my mobile

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsub...@googlegroups.com.
To post to this group, send email to robotframework-users@googlegroups.com.

Jukka Väyrynen

unread,
Mar 30, 2017, 6:41:20 AM3/30/17
to robotframework-users
Hi, Don't know who Bryan is but anyway I tried the Robot Remote Library interface and it works. Only issue which there is anymore is that I can connect the remote library to the remote server only when windows firewall is off from remote server machine. I have tried to open port to the firewall for remote server, but without success. There is something in port opening what I dont understand or somewhere else. (I am quite newbie what comes to the computer skills)


Jukka Väyrynen

unread,
Apr 3, 2017, 3:21:40 AM4/3/17
to robotframework-users
Problem solved. Just needed to create Inbound rule for firewall which allows connections to python.
Reply all
Reply to author
Forward
0 new messages