{"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":"\n