{"id":751,"date":"2018-11-01T06:00:29","date_gmt":"2018-11-01T06:00:29","guid":{"rendered":"http:\/\/buklijas.info\/blog\/?p=751"},"modified":"2018-12-14T21:15:40","modified_gmt":"2018-12-14T21:15:40","slug":"introducing-pyautogui","status":"publish","type":"post","link":"http:\/\/buklijas.info\/blog\/2018\/11\/01\/introducing-pyautogui\/","title":{"rendered":"Introducing PyAutoGUI"},"content":{"rendered":"

Published on:<\/strong> 01.11.2018<\/p>\n

I found out about PyAutoGUI Python packet from Automate the Boring Stuff with Python<\/a> book.<\/p>\n

With PyAutoGUI you can automate GUI interaction<\/strong> on your computer.<\/p>\n

PyAutoGUI<\/a> is working on Windows, OSX and Linux, altho I have used it only on Windows.<\/p>\n

Most GUI automation can be done just by automating mouse movements and keyboard input<\/strong> and PyAutoGUI supports it.<\/p>\n

There are also functions for providing message boxes, saving the screenshot and finding an element from the image on the screen.<\/p>\n

Personally, I have found PyAutoGUI useful, for automating some of my workflows<\/strong>.<\/p>\n

To be honest, I use it for 45 minutes of work every month (I know this is not much), but I have found that if I manually have to do same interactions for 45 minutes it is really killing my soul<\/strong>, so I decide just to automate it.<\/p>\n

If you want to automate web page interaction<\/strong> use Selenium<\/a>, because with Selenium you can access elements<\/a> on a web page independent of their position on the screen.<\/p>\n

Because with PyAutoGUI you can just move the mouse to specific coordinates, that means if the resolution or layout of GUI has been changed<\/strong>, you need to update coordinates in your code.<\/p>\n

Keep all coordinate in your code as constant in one place<\/strong>, so that you do not need to change them all over your code when change is needed.<\/p>\n

This theoretically could be avoided<\/strong> if you use images as reference for finding elements on your GUI, but you will have the same problem if the appearance of the elements is changed, but then instead of changing coordinate in the code you have to change all reference images, what is more work.<\/p>\n

My personal preference is to use hardcoded coordinated<\/strong> instead of images as the reference.<\/p>\n

Using Selenium has also become popular for scraping pieces of information from web pages<\/strong>, but better is to use specialized framework for scraping like Scrapy<\/a>, because of additional features like caching HTTP responses (quite a time saver in development).<\/p>\n","protected":false},"excerpt":{"rendered":"

Published on: 01.11.2018 I found out about PyAutoGUI Python packet from Automate the Boring Stuff with Python book. With PyAutoGUI you can automate GUI interaction on your computer. PyAutoGUI is working on Windows, OSX and Linux, altho I have used it only on Windows. Most GUI automation can be done just by automating mouse movements […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"Introducing PyAutoGUI","jetpack_is_tweetstorm":false},"categories":[27],"tags":[49,4],"jetpack_featured_media_url":"","jetpack_publicize_connections":[],"yoast_head":"\nIntroducing PyAutoGUI - Sasa Buklijas<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/buklijas.info\/blog\/2018\/11\/01\/introducing-pyautogui\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Introducing PyAutoGUI - Sasa Buklijas\" \/>\n<meta property=\"og:description\" content=\"Published on: 01.11.2018 I found out about PyAutoGUI Python packet from Automate the Boring Stuff with Python book. With PyAutoGUI you can automate GUI interaction on your computer. PyAutoGUI is working on Windows, OSX and Linux, altho I have used it only on Windows. Most GUI automation can be done just by automating mouse movements […]\" \/>\n<meta property=\"og:url\" content=\"http:\/\/buklijas.info\/blog\/2018\/11\/01\/introducing-pyautogui\/\" \/>\n<meta property=\"og:site_name\" content=\"Sasa Buklijas\" \/>\n<meta property=\"article:published_time\" content=\"2018-11-01T06:00:29+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-12-14T21:15:40+00:00\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\">\n\t<meta name=\"twitter:data1\" content=\"Sasa Buklijas\">\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\">\n\t<meta name=\"twitter:data2\" content=\"1 minute\">\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"http:\/\/buklijas.info\/blog\/#website\",\"url\":\"http:\/\/buklijas.info\/blog\/\",\"name\":\"Sasa Buklijas\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"http:\/\/buklijas.info\/blog\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"http:\/\/buklijas.info\/blog\/2018\/11\/01\/introducing-pyautogui\/#webpage\",\"url\":\"http:\/\/buklijas.info\/blog\/2018\/11\/01\/introducing-pyautogui\/\",\"name\":\"Introducing PyAutoGUI - Sasa Buklijas\",\"isPartOf\":{\"@id\":\"http:\/\/buklijas.info\/blog\/#website\"},\"datePublished\":\"2018-11-01T06:00:29+00:00\",\"dateModified\":\"2018-12-14T21:15:40+00:00\",\"author\":{\"@id\":\"http:\/\/buklijas.info\/blog\/#\/schema\/person\/780025d597f1c5df3cc156eaffc8c561\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/buklijas.info\/blog\/2018\/11\/01\/introducing-pyautogui\/\"]}]},{\"@type\":\"Person\",\"@id\":\"http:\/\/buklijas.info\/blog\/#\/schema\/person\/780025d597f1c5df3cc156eaffc8c561\",\"name\":\"Sasa Buklijas\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"http:\/\/buklijas.info\/blog\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"http:\/\/0.gravatar.com\/avatar\/9f6f7de5a4882517ca0e4a8ebd607925?s=96&d=mm&r=g\",\"caption\":\"Sasa Buklijas\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p5YHGV-c7","_links":{"self":[{"href":"http:\/\/buklijas.info\/blog\/wp-json\/wp\/v2\/posts\/751"}],"collection":[{"href":"http:\/\/buklijas.info\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/buklijas.info\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/buklijas.info\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/buklijas.info\/blog\/wp-json\/wp\/v2\/comments?post=751"}],"version-history":[{"count":6,"href":"http:\/\/buklijas.info\/blog\/wp-json\/wp\/v2\/posts\/751\/revisions"}],"predecessor-version":[{"id":791,"href":"http:\/\/buklijas.info\/blog\/wp-json\/wp\/v2\/posts\/751\/revisions\/791"}],"wp:attachment":[{"href":"http:\/\/buklijas.info\/blog\/wp-json\/wp\/v2\/media?parent=751"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/buklijas.info\/blog\/wp-json\/wp\/v2\/categories?post=751"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/buklijas.info\/blog\/wp-json\/wp\/v2\/tags?post=751"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}