Created
July 29, 2015 09:02
-
-
Save neosb/4ec47961fe685eacf4da to your computer and use it in GitHub Desktop.
Speed up startup of Sikuli script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This is Sikuli script | |
| # More about SimpleXMLRPCServer: https://docs.python.org/2/library/simplexmlrpcserver.html | |
| #import xmlrpclib # is this necessary? | |
| from SimpleXMLRPCServer import SimpleXMLRPCServer | |
| def click_it(): | |
| ''' | |
| Some function to do testing automation | |
| ''' | |
| click("image.png") | |
| return "Success!" | |
| server = SimpleXMLRPCServer(("localhost", 8000)) # create server listening on port 8000 | |
| print "Listening on port 8000..." # For your information | |
| server.register_function(click_it, "click") # custom name for method | |
| server.serve_forever() # eternal loop (until the power goes off) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This is client for XML-RPC interface exposed from Sikuli script file | |
| # If you wish, you can do this in any other language with xml-rpc support | |
| # Link to Wikipedia: https://en.wikipedia.org/wiki/XML-RPC | |
| # Note it's Python 3.4 | |
| #!/usr/bin/env python3 | |
| import xmlrpc.client # xmlrpclib in Python 2.x | |
| # s = xmlrpclib.ServerProxy('http://localhost:8000') in Python 2.x | |
| s = xmlrpc.client.ServerProxy("http://localhost:8000/") # connecting from the same machine | |
| print(s.click()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment