{"id":143257,"date":"2022-06-13T11:40:26","date_gmt":"2022-06-13T15:40:26","guid":{"rendered":"https:\/\/ibkrcampus.com\/?p=143257"},"modified":"2022-11-21T09:55:23","modified_gmt":"2022-11-21T14:55:23","slug":"3-ways-to-do-rpa-with-python","status":"publish","type":"post","link":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/3-ways-to-do-rpa-with-python\/","title":{"rendered":"3 Ways to Do RPA with Python"},"content":{"rendered":"\n<p>In this post we\u2019ll cover a few packages for doing robotic process automation with Python. Robotic process automation, or RPA, is the process of automating mouse clicks and keyboard presses \u2013 i.e. simulating what a human user would do. RPA is used in a variety of applications, including data entry, accounting, finance, and more.<\/p>\n\n\n\n<p>We\u2019ll be covering&nbsp;<strong>pynput<\/strong>,&nbsp;<strong>pyautogui<\/strong>, and&nbsp;<strong>pywinauto<\/strong>. Each of these three packages can be used as a starting point for building your own RPA application, as well as building UI testing apps.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-pynput\"><strong>pynput<\/strong><\/h2>\n\n\n\n<p>The first package we\u2019ll discuss is&nbsp;<strong>pynput<\/strong>. One of the advantages of&nbsp;<strong>pynput<\/strong>&nbsp;is that is works on both Windows and macOS. Another nice feature is that it has functionality to monitor keyboard and mouse input. Let\u2019s get started with&nbsp;<strong>pynput<\/strong>&nbsp;by installing it with pip:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pip install pynput<\/code><\/pre>\n\n\n\n<p>Once you have it installed, you can get started by importing the&nbsp;<em>Controller<\/em>&nbsp;and&nbsp;<em>Button<\/em>&nbsp;classes. Then, we\u2019ll create an instance of the&nbsp;<em>Controller<\/em>&nbsp;class, which we\u2019ll call&nbsp;<em>mouse<\/em>. This will simulate your computer\u2019s mouse to allow you to programmatically click buttons and move the mouse around on the screen.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>from pynput.mouse import Button, Controller\n \nmouse = Controller()<\/code><\/pre>\n\n\n\n<p>Next, let\u2019s look at a couple simple commands. To right or left-click, we can use the Button class imported above.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># left-click\nmouse.press(Button.left)\n \n# right-click\nmouse.press(Button.right)<\/code><\/pre>\n\n\n\n<p>To double click, you just need to add the number two as the second parameter.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mouse.press(Button.left, 2)<\/code><\/pre>\n\n\n\n<p>We can also move the mouse pointer to a different position by using the&nbsp;<em>move<\/em>&nbsp;method.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mouse.move(50, -50)\n \nmouse.move(100, -200)<\/code><\/pre>\n\n\n\n<p><strong>pynput<\/strong>&nbsp;can control the keyboard, as well. To do that, we need to import the&nbsp;<em>Key<\/em>&nbsp;class<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\nfrom pynput.keyboard import Key<\/code><\/pre>\n\n\n\n<p>To make your keyboard type, you can use the aptly-named&nbsp;<em>keyboard.type<\/em>&nbsp;method.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\t\nkeyboard.type(\"this is a test\")<\/code><\/pre>\n\n\n\n<p>As mentioned above,&nbsp;<strong>pynput<\/strong>&nbsp;can also monitor mouse movements and keyboard presses. To learn more about that functionality and&nbsp;<strong>pynput<\/strong>,&nbsp;<a href=\"https:\/\/pypi.org\/project\/pynput\/\">check out this link.<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>pyautogui<\/strong><\/h2>\n\n\n\n<p>Perhaps the most commonly known package for simulating mouse clicks and keyboard entries is the&nbsp;<strong>pyautogui<\/strong>&nbsp;library.&nbsp;<strong>pyautogui<\/strong>&nbsp;works on Windows, Linux, and macOS. If you don\u2019t have it installed, you can get it using pip:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pip install pyautogui<\/code><\/pre>\n\n\n\n<p><strong>pyautogui<\/strong>&nbsp;is also straightforward to use. For example, if you want to simulate typing a string of text, just use the&nbsp;<em>typewrite<\/em>&nbsp;method:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pyautogui.typewrite(\"test pyautogui!\")<\/code><\/pre>\n\n\n\n<p>To left-click your mouse, you can use the&nbsp;<em>click<\/em>&nbsp;method. To right-click, you can use the&nbsp;<em>rightClick<\/em>&nbsp;method.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># left-click\npyautogui.click(100, 200)\n \n# right-click\npyautogui.rightClick(100, 200)<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Searching for an image on the screen<\/strong><\/h4>\n\n\n\n<p>One of the coolest features of&nbsp;<strong>pyautogui<\/strong>&nbsp;is that it can search for an image on the computer screen. This is really helpful if you need to find a particular button to click. You can search for an image by inputting the image file name into the&nbsp;<em>locateOnScreen<\/em>&nbsp;method. The function returns the topleft coordinate along with the height and width of the identified image.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>location = pyautogui.locateOnScreen(\"random_image.png\")<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image img-twothird\"><img decoding=\"async\" width=\"436\" height=\"61\" data-src=\"\/campus\/wp-content\/uploads\/sites\/2\/2022\/06\/python-pyautogui-locateonscreen-the-automatic-net.png\" alt=\"\" class=\"wp-image-143347 lazyload\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2022\/06\/python-pyautogui-locateonscreen-the-automatic-net.png 436w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2022\/06\/python-pyautogui-locateonscreen-the-automatic-net-300x42.png 300w\" data-sizes=\"(max-width: 436px) 100vw, 436px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 436px; aspect-ratio: 436\/61;\" \/><\/figure>\n\n\n\n<p>To get the center of identified image, use the&nbsp;<em>center<\/em>&nbsp;method. Then, you can use the&nbsp;<em>click<\/em>&nbsp;method to click on the center of the identified image \u2013 in this case, a button on the screen.<\/p>\n\n\n\n<figure class=\"wp-block-image img-twothird\"><img decoding=\"async\" width=\"563\" height=\"105\" data-src=\"\/campus\/wp-content\/uploads\/sites\/2\/2022\/06\/pyautogui-center-the-automatic-net.png\" alt=\"\" class=\"wp-image-143348 lazyload\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2022\/06\/pyautogui-center-the-automatic-net.png 563w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2022\/06\/pyautogui-center-the-automatic-net-300x56.png 300w\" data-sizes=\"(max-width: 563px) 100vw, 563px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 563px; aspect-ratio: 563\/105;\" \/><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code>center = pyautogui.center(location)\n \npyautogui.click(center)<\/code><\/pre>\n\n\n\n<p>Sometimes an image may not be found exactly on a screen. In this case, you can add the&nbsp;<em>confidence<\/em>&nbsp;parameter to&nbsp;<em>locateOnScreen<\/em>&nbsp;to give Python a confidence level of identifying the image.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pyautogui.locateOnScreen(\"random_image.png\", confidence = 0.95)<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Taking a screenshot<\/strong><\/h4>\n\n\n\n<p>You can take a screenshot with&nbsp;<strong>pyautogui<\/strong>&nbsp;using the&nbsp;<em>screenshot<\/em>&nbsp;method. Passing a filename will save the screenshot out to that file.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\t\ns = pyautogui.screenshot(\"sample_screenshot.png\")<\/code><\/pre>\n\n\n\n<p>It\u2019s also possible to take a screenshot of a specific region, rather than the full screen:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\t\npyautogui.screenshot(region = c(0, 0, 100, 200))<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>pywinauto<\/strong><\/h2>\n\n\n\n<p>On Windows, another option we can look into is the&nbsp;<strong>pywinauto<\/strong>&nbsp;library. The main disadvantage of this library is that it does not work on macOS or Linux. However, it also offers a couple of nice advantages for Windows users. One, it\u2019s syntax is object-oriented \u2013 it\u2019s made to be more Pythonic. Secondly, because of its design, the library can make it easier to perform certain tasks, like clicking on specific buttons or finding menu items in an application.<\/p>\n\n\n\n<p>For example, let\u2019s start by launching Notepad, typing some text, and saving the file. We can do that using the code snippet below. Here, we start Notepad by using the&nbsp;<em>Application<\/em>&nbsp;class. Then, we refer to the Notepad file we just opened by \u201cUnitledNotepad\u201d. We can use the&nbsp;<em>Edit.type_keys<\/em>&nbsp;to start typing text.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>from pywinauto.application import Application\n \napp = Application(backend=\"uia\").start(\"notepad.exe\")\napp.UntitledNotepad.Edit.type_keys(\"Starting notepad...\")\napp.UntitledNotepad.menu_select(\"File-&gt;SaveAs\")\nsub_app=app.UntitledNotepad.child_window(title_re = \"Save As\")\nsub_app.FileNameCombo.type_keys(\"test_file.txt\")\nsub_app.Save.click()<\/code><\/pre>\n\n\n\n<p>Learn more about&nbsp;<strong>pywinauto<\/strong>&nbsp;by checking out&nbsp;<a href=\"https:\/\/pywinauto.readthedocs.io\/en\/latest\/\">this link<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Conclusion<\/strong><\/h2>\n\n\n\n<p>That\u2019s it for this post! We covered three packages for doing robotic process automation with Python.&nbsp;<a href=\"https:\/\/theautomatic.net\/category\/python\/\">Check out my other Python posts here<\/a>.<\/p>\n\n\n\n<p><em>Visit <a href=\"https:\/\/theautomatic.net\/2020\/12\/17\/3-ways-to-do-rpa-with-python\/\">TheAutomatic.net<\/a> additional insight on this topic.  <\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this post we\u2019ll cover a few packages for doing robotic process automation with Python. Robotic process automation, or RPA, is the process of automating mouse clicks and keyboard presses \u2013 i.e. simulating what a human user would do.<\/p>\n","protected":false},"author":388,"featured_media":52874,"comment_status":"closed","ping_status":"open","sticky":true,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[339,343,349,338,341,352,344],"tags":[806,865,12058,12057,595,12059,12060],"contributors-categories":[13695],"class_list":{"0":"post-143257","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-data-science","8":"category-programing-languages","9":"category-python-development","10":"category-ibkr-quant-news","11":"category-quant-development","12":"category-quant-north-america","13":"category-quant-regions","14":"tag-data-science","15":"tag-github","16":"tag-pyautogui","17":"tag-pynput","18":"tag-python","19":"tag-pywinauto","20":"tag-robotic-process-automation-rpa","21":"contributors-categories-theautomatic-net"},"pp_statuses_selecting_workflow":false,"pp_workflow_action":"current","pp_status_selection":"publish","acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.9 (Yoast SEO v27.5) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>3 Ways to Do RPA with Python | IBKR Quant<\/title>\n<meta name=\"description\" content=\"In this post we\u2019ll cover a few packages for doing robotic process automation with Python. Robotic process automation, or RPA, is the process of...\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.interactivebrokers.com\/campus\/wp-json\/wp\/v2\/posts\/143257\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"3 Ways to Do RPA with Python | IBKR Quant Blog\" \/>\n<meta property=\"og:description\" content=\"In this post we\u2019ll cover a few packages for doing robotic process automation with Python. Robotic process automation, or RPA, is the process of automating mouse clicks and keyboard presses \u2013 i.e. simulating what a human user would do.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/3-ways-to-do-rpa-with-python\/\" \/>\n<meta property=\"og:site_name\" content=\"IBKR Campus US\" \/>\n<meta property=\"article:published_time\" content=\"2022-06-13T15:40:26+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-11-21T14:55:23+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2020\/07\/python-laptop-1.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"900\" \/>\n\t<meta property=\"og:image:height\" content=\"550\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Andrew Treadway\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Andrew Treadway\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\n\t    \"@context\": \"https:\\\/\\\/schema.org\",\n\t    \"@graph\": [\n\t        {\n\t            \"@type\": \"NewsArticle\",\n\t            \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/3-ways-to-do-rpa-with-python\\\/#article\",\n\t            \"isPartOf\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/3-ways-to-do-rpa-with-python\\\/\"\n\t            },\n\t            \"author\": {\n\t                \"name\": \"Andrew Treadway\",\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/person\\\/d4018570a16fb867f1c08412fc9c64bc\"\n\t            },\n\t            \"headline\": \"3 Ways to Do RPA with Python\",\n\t            \"datePublished\": \"2022-06-13T15:40:26+00:00\",\n\t            \"dateModified\": \"2022-11-21T14:55:23+00:00\",\n\t            \"mainEntityOfPage\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/3-ways-to-do-rpa-with-python\\\/\"\n\t            },\n\t            \"wordCount\": 804,\n\t            \"publisher\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#organization\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/3-ways-to-do-rpa-with-python\\\/#primaryimage\"\n\t            },\n\t            \"thumbnailUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2020\\\/07\\\/python-laptop-1.jpg\",\n\t            \"keywords\": [\n\t                \"Data Science\",\n\t                \"GitHub\",\n\t                \"pyautogui\",\n\t                \"pynput\",\n\t                \"Python\",\n\t                \"pywinauto\",\n\t                \"Robotic Process Automation (RPA)\"\n\t            ],\n\t            \"articleSection\": [\n\t                \"Data Science\",\n\t                \"Programming Languages\",\n\t                \"Python Development\",\n\t                \"Quant\",\n\t                \"Quant Development\",\n\t                \"Quant North America\",\n\t                \"Quant Regions\"\n\t            ],\n\t            \"inLanguage\": \"en-US\"\n\t        },\n\t        {\n\t            \"@type\": \"WebPage\",\n\t            \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/3-ways-to-do-rpa-with-python\\\/\",\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/3-ways-to-do-rpa-with-python\\\/\",\n\t            \"name\": \"3 Ways to Do RPA with Python | IBKR Quant Blog\",\n\t            \"isPartOf\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#website\"\n\t            },\n\t            \"primaryImageOfPage\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/3-ways-to-do-rpa-with-python\\\/#primaryimage\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/3-ways-to-do-rpa-with-python\\\/#primaryimage\"\n\t            },\n\t            \"thumbnailUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2020\\\/07\\\/python-laptop-1.jpg\",\n\t            \"datePublished\": \"2022-06-13T15:40:26+00:00\",\n\t            \"dateModified\": \"2022-11-21T14:55:23+00:00\",\n\t            \"description\": \"In this post we\u2019ll cover a few packages for doing robotic process automation with Python. Robotic process automation, or RPA, is the process of automating mouse clicks and keyboard presses \u2013 i.e. simulating what a human user would do.\",\n\t            \"inLanguage\": \"en-US\",\n\t            \"potentialAction\": [\n\t                {\n\t                    \"@type\": \"ReadAction\",\n\t                    \"target\": [\n\t                        \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/3-ways-to-do-rpa-with-python\\\/\"\n\t                    ]\n\t                }\n\t            ]\n\t        },\n\t        {\n\t            \"@type\": \"ImageObject\",\n\t            \"inLanguage\": \"en-US\",\n\t            \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/3-ways-to-do-rpa-with-python\\\/#primaryimage\",\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2020\\\/07\\\/python-laptop-1.jpg\",\n\t            \"contentUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2020\\\/07\\\/python-laptop-1.jpg\",\n\t            \"width\": 900,\n\t            \"height\": 550,\n\t            \"caption\": \"Python\"\n\t        },\n\t        {\n\t            \"@type\": \"WebSite\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#website\",\n\t            \"url\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/\",\n\t            \"name\": \"IBKR Campus US\",\n\t            \"description\": \"Financial Education from Interactive Brokers\",\n\t            \"publisher\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#organization\"\n\t            },\n\t            \"potentialAction\": [\n\t                {\n\t                    \"@type\": \"SearchAction\",\n\t                    \"target\": {\n\t                        \"@type\": \"EntryPoint\",\n\t                        \"urlTemplate\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/?s={search_term_string}\"\n\t                    },\n\t                    \"query-input\": {\n\t                        \"@type\": \"PropertyValueSpecification\",\n\t                        \"valueRequired\": true,\n\t                        \"valueName\": \"search_term_string\"\n\t                    }\n\t                }\n\t            ],\n\t            \"inLanguage\": \"en-US\"\n\t        },\n\t        {\n\t            \"@type\": \"Organization\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#organization\",\n\t            \"name\": \"Interactive Brokers\",\n\t            \"alternateName\": \"IBKR\",\n\t            \"url\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/\",\n\t            \"logo\": {\n\t                \"@type\": \"ImageObject\",\n\t                \"inLanguage\": \"en-US\",\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/logo\\\/image\\\/\",\n\t                \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2024\\\/05\\\/ibkr-campus-logo.jpg\",\n\t                \"contentUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2024\\\/05\\\/ibkr-campus-logo.jpg\",\n\t                \"width\": 669,\n\t                \"height\": 669,\n\t                \"caption\": \"Interactive Brokers\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/logo\\\/image\\\/\"\n\t            },\n\t            \"publishingPrinciples\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/about-ibkr-campus\\\/\",\n\t            \"ethicsPolicy\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/cyber-security-notice\\\/\"\n\t        },\n\t        {\n\t            \"@type\": \"Person\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/person\\\/d4018570a16fb867f1c08412fc9c64bc\",\n\t            \"name\": \"Andrew Treadway\",\n\t            \"description\": \"Andrew Treadway currently works as a Senior Data Scientist, and has experience doing analytics, software automation, and ETL. He completed a master\u2019s degree in computer science \\\/ machine learning, and an undergraduate degree in pure mathematics. Connect with him on LinkedIn: https:\\\/\\\/www.linkedin.com\\\/in\\\/andrew-treadway-a3b19b103\\\/In addition to TheAutomatic.net blog, he also teaches in-person courses on Python and R through my NYC meetup: more details.\",\n\t            \"sameAs\": [\n\t                \"https:\\\/\\\/theautomatic.net\\\/about-me\\\/\"\n\t            ],\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/author\\\/andrewtreadway\\\/\"\n\t        }\n\t    ]\n\t}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"3 Ways to Do RPA with Python | IBKR Quant","description":"In this post we\u2019ll cover a few packages for doing robotic process automation with Python. Robotic process automation, or RPA, is the process of...","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.interactivebrokers.com\/campus\/wp-json\/wp\/v2\/posts\/143257\/","og_locale":"en_US","og_type":"article","og_title":"3 Ways to Do RPA with Python | IBKR Quant Blog","og_description":"In this post we\u2019ll cover a few packages for doing robotic process automation with Python. Robotic process automation, or RPA, is the process of automating mouse clicks and keyboard presses \u2013 i.e. simulating what a human user would do.","og_url":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/3-ways-to-do-rpa-with-python\/","og_site_name":"IBKR Campus US","article_published_time":"2022-06-13T15:40:26+00:00","article_modified_time":"2022-11-21T14:55:23+00:00","og_image":[{"width":900,"height":550,"url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2020\/07\/python-laptop-1.jpg","type":"image\/jpeg"}],"author":"Andrew Treadway","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Andrew Treadway","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"NewsArticle","@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/3-ways-to-do-rpa-with-python\/#article","isPartOf":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/3-ways-to-do-rpa-with-python\/"},"author":{"name":"Andrew Treadway","@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/person\/d4018570a16fb867f1c08412fc9c64bc"},"headline":"3 Ways to Do RPA with Python","datePublished":"2022-06-13T15:40:26+00:00","dateModified":"2022-11-21T14:55:23+00:00","mainEntityOfPage":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/3-ways-to-do-rpa-with-python\/"},"wordCount":804,"publisher":{"@id":"https:\/\/ibkrcampus.com\/campus\/#organization"},"image":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/3-ways-to-do-rpa-with-python\/#primaryimage"},"thumbnailUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2020\/07\/python-laptop-1.jpg","keywords":["Data Science","GitHub","pyautogui","pynput","Python","pywinauto","Robotic Process Automation (RPA)"],"articleSection":["Data Science","Programming Languages","Python Development","Quant","Quant Development","Quant North America","Quant Regions"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/3-ways-to-do-rpa-with-python\/","url":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/3-ways-to-do-rpa-with-python\/","name":"3 Ways to Do RPA with Python | IBKR Quant Blog","isPartOf":{"@id":"https:\/\/ibkrcampus.com\/campus\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/3-ways-to-do-rpa-with-python\/#primaryimage"},"image":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/3-ways-to-do-rpa-with-python\/#primaryimage"},"thumbnailUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2020\/07\/python-laptop-1.jpg","datePublished":"2022-06-13T15:40:26+00:00","dateModified":"2022-11-21T14:55:23+00:00","description":"In this post we\u2019ll cover a few packages for doing robotic process automation with Python. Robotic process automation, or RPA, is the process of automating mouse clicks and keyboard presses \u2013 i.e. simulating what a human user would do.","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/3-ways-to-do-rpa-with-python\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/3-ways-to-do-rpa-with-python\/#primaryimage","url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2020\/07\/python-laptop-1.jpg","contentUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2020\/07\/python-laptop-1.jpg","width":900,"height":550,"caption":"Python"},{"@type":"WebSite","@id":"https:\/\/ibkrcampus.com\/campus\/#website","url":"https:\/\/ibkrcampus.com\/campus\/","name":"IBKR Campus US","description":"Financial Education from Interactive Brokers","publisher":{"@id":"https:\/\/ibkrcampus.com\/campus\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ibkrcampus.com\/campus\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/ibkrcampus.com\/campus\/#organization","name":"Interactive Brokers","alternateName":"IBKR","url":"https:\/\/ibkrcampus.com\/campus\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/logo\/image\/","url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/ibkr-campus-logo.jpg","contentUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/ibkr-campus-logo.jpg","width":669,"height":669,"caption":"Interactive Brokers"},"image":{"@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/logo\/image\/"},"publishingPrinciples":"https:\/\/www.interactivebrokers.com\/campus\/about-ibkr-campus\/","ethicsPolicy":"https:\/\/www.interactivebrokers.com\/campus\/cyber-security-notice\/"},{"@type":"Person","@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/person\/d4018570a16fb867f1c08412fc9c64bc","name":"Andrew Treadway","description":"Andrew Treadway currently works as a Senior Data Scientist, and has experience doing analytics, software automation, and ETL. He completed a master\u2019s degree in computer science \/ machine learning, and an undergraduate degree in pure mathematics. Connect with him on LinkedIn: https:\/\/www.linkedin.com\/in\/andrew-treadway-a3b19b103\/In addition to TheAutomatic.net blog, he also teaches in-person courses on Python and R through my NYC meetup: more details.","sameAs":["https:\/\/theautomatic.net\/about-me\/"],"url":"https:\/\/www.interactivebrokers.com\/campus\/author\/andrewtreadway\/"}]}},"jetpack_featured_media_url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2020\/07\/python-laptop-1.jpg","_links":{"self":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts\/143257","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/users\/388"}],"replies":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/comments?post=143257"}],"version-history":[{"count":0,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts\/143257\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/media\/52874"}],"wp:attachment":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/media?parent=143257"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/categories?post=143257"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/tags?post=143257"},{"taxonomy":"contributors-categories","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/contributors-categories?post=143257"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}