Skip to main content

Example Python Script Using Eggdrive

This example shows how you can use Eggdrive in a Python script. For more information about how to use Eggdrive, see Using Eggdrive.

import xmlrpc.client

def main():
# Create the server proxy
server = xmlrpc.client.ServerProxy("")

# Start the session

# Connect to a SUT
server.execute ('connect "localhost"')

# Launch Chrome (Where, "Chrome" is an image of its icon)
result= server.execute ('DoubleClick "Chrome"')
print (result)

# Wait for the search box to appear
result= server.execute ('Click (Text: "Search Google or type a URL", WaitFor: 10)')
print (result)

# Go to the Eggplant website
result= server.execute ('TypeText("" & returnKey)')
print (result)

# Wait for the banner
result= server.execute('WaitFor 10.0', '(Text: "Let\'s rid the world of bad software")')
print (result)

# Quit Chrome
result= server.execute ('TypeText(altKey, f4)')
print (result)
except Exception as exc:
print("An exception occurred: {}".format(exc))

# End the session
server.endsession ("")
except Exception as exc:
print("An exception occurred: {}".format(exc))

if __name__ == '__main__':