Sikuli Tutorial 2: Program visually in python!

sentdex · Beginner ·🛠️ AI Tools & Apps ·12y ago

Key Takeaways

Tutorials programming visually in Python using Sikuli

Full Transcript

All right. So, what we've got here, I've got the suli script that we're going to write over here. And then I've just got the browser open. We could obviously start from scratch, have it open up a browser, but here we go. And so, what we're going to go ahead and do is uh start here. And the first thing we want to do is we want to have the mouse come to this address bar. and like click on the address bar. So, the way that we're going to do that is we want it to click. And where do we want it to click? It's going to be um right here. So, that's where we want it to click. Now, just to make sure cuz it might think like the mouse I I believe where it makes that uh crossover is where it will naturally Oh, shoot. Oh, there we go. Okay. Where it will naturally click is there. But if we go Oh, it's like all my screens. Anyway, so okay, you can see where it wants to click, but you could tell it like, no, I really want the mouse to click here or here. Um, the next thing that you might want to do that you can change up, um, is, uh, sorry, this probably looks really confusing because it's showing like I've got four monitors, so it's like this huge mess. Yours should just be a regular square, though. But what it's going to do, I wish there was a way for me to like zoom into my main monitor. Um, anyway, you can see here there's got this similarity. So, it's always a good idea to kind of check this and see, okay, how many similar places are there? And you can require how similar you want it to be. Like if we drop this, you can see that oh, there's a similar to here, here, here, here, here, here, here. But obviously, the most strong one is is this one. But if you raise it up enough, the only one it's going to find is the correct one. So anyway, we'll just hit apply. Okay. And now you can see here in our little image exactly where it's going to stick the mouse to click on this image. So, real quick, since I know everyone's just excited as heck with Sakuli, let's hit run and see what it does. So, we hit run. Oh, we got to save it. Let's see. We'll just run immediately. So, you saw maybe hopefully within um you can see that it move it took my mouse and it moved it and we did click there. So, now that's actually now that we've clicked there, the next thing we might want to do is uh we want to type in something. So, let's say type and in here we want to type um scentex oops scentex.com. So, now let's uh let's actually save this so we don't run into any problems. Let me save it real quick and we'll do save. And we're just going to save this as uh sule toot. Awesome. So now what we'll do, we'll run it and let's see where it goes. Image. I think uh this must have been saving it somewhere. So let's let's retake this image real quick. I guess we'll have to Yeah, let's just redo this image, I think, because it's it's looking for it saves the images in a little bit of a like a file basically. And um so let's say where do we click? So since those um since we saved it in a new directory, I think that's that's the problem is it just doesn't know. So let's do that. And then let's uh edit this target offset. We want to make let's just offset just slightly. Apply. Okay. Okay. So now let's save it. Let's run it. And you can see okay, now it goes there. It types sent.com. Now the next thing we want it to do is hit the enter key, right? And so you obviously can't say like click enter or something like that, right? So now we need to change that up. So how do we do that? So as far as I know, I believe you do key dot um and then like we would do I think it's all caps enter, but you'll have to bear with me. There's also uh say you wanted to do like control um C, you can do like uh key down. Oops, sorry. We're all caps. uh like key down and then do something. But for now, we'll get to that eventually. Um so I think we can actually put syntax.com and then you can say plus and then do key. Oops, got to uppercase that key and then we'll do enter. Plus key enter. And that should take us to the website. We'll see what happens. Let me empty out the address bar here. Uh let's save our suli script and let's run it. Goes here. Hit enter. Sure enough, it takes us to the website. Now, we're already logged into this website. So, let me go ahead and log out real quick. Let's say log out. Hopefully, it'll save us logged out. Let's try it again. Let's run it one more time. See if it keeps us logged out. Hey. Oh, yeah. Oh, so if you have something in the address bar. Okay. So, here's a here's a good thing to run through real quick. So, what's happening is it's looking for this image and this image contains a completely empty uh bar. So, it's probably having a hard time finding it. Like, let me click on this and see our matching preview. Yeah. So, as you can see, it's not finding it. we have a pretty stringent uh match. But I bet if we just turned it down a little bit like here, it would find it pretty quick. But there's a better way to do it cuz you wouldn't want it to find like multiple things cuz this is where suli could go wrong. Obviously, you could use some good logic with it. But what you can do is since like for example this will change like when you're using a browser you know this might might change your forward and backs might change a little bit but for the most part uh what's going to change the most is going to be this the text and the image recognition is that it's quite good. So you can use that to your advantage but also it can kind of mess you up sometimes. So let me show you how to fix this sort of a problem and then I'll pause the video and we'll continue on um in in the next video. So let's say instead uh let's get rid of this click. And the way what you can do to kind of uh remedy this situation is take an image. So let's say okay we're going to click here right or or we're going to do oh shoot we shouldn't have sorry I hovered over this button so that's going to cause a problem. So let me fix this really quick. So one more time click. Wait till it comes up. Okay. So, we want to click in this area. Make sure we don't get any of that blue. But, or actually, let's even do it this way. So, we want to click in this area, but then what we do is we change this target offset to actually be all the way over here, right? So, this is the image it's going to look for, and it's going to click over here. So, that way, um, you're kind of circumventing any issues with stuff being in there. So, let's hit apply. Okay. And now let's put this where it needs to be first of all. Or cut and paste this down here. Put this up here. Save. And now let's run it. And hopefully that'll work out for us. Kind of messed up our URL. Let's try again one more time. There we go. Okay. So now it's actually taking us to sentex.com. Still the same way as before. And if something's in the address bar, let's try again. It might be because it's maybe not highlighting it. But I'll tell you what you can do. Sometimes what you can do is you could click and you can drag over to here and then type the website. So I mean there's all kinds of different things, but Suli is not only for the browser. So and really if you're going to be doing something in a browser, it's sometimes better to use um Selenium anyway, but I'm just trying to get you guys used to using um Suli. So anyway, I'm going to cut off the uh the video here and then we'll continue on in the next video um with logging in with Suli. So, um, as always, thanks for watching. Stay tuned to the next video.

Original Description

Cool Python Programs Playlist: http://www.youtube.com/playlist?list=PLQVvvaa0QuDd2eLUw6i-Pbk3H_15Lfo3b Sentdex.com Facebook.com/sentdex Twitter.com/sentdex
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from sentdex · sentdex · 50 of 60

1 Matplotlib Python Tutorial Part 1: Basics and your first Graph!
Matplotlib Python Tutorial Part 1: Basics and your first Graph!
sentdex
2 Python Encryption Tutorial with PyCrypto
Python Encryption Tutorial with PyCrypto
sentdex
3 Python's Logging Function
Python's Logging Function
sentdex
4 wxPython Tutorials 1: Making Windows GUIs with Python : Installing + 1st window!
wxPython Tutorials 1: Making Windows GUIs with Python : Installing + 1st window!
sentdex
5 wxPython Tutorials 2: Making Windows GUIs with Python: Customizing Window Parameters
wxPython Tutorials 2: Making Windows GUIs with Python: Customizing Window Parameters
sentdex
6 wxPython Programming Tutorial 3: Menu Bar and Menu Button
wxPython Programming Tutorial 3: Menu Bar and Menu Button
sentdex
7 wxPython Programming Tutorial 4: Panels
wxPython Programming Tutorial 4: Panels
sentdex
8 wxPython Programming Tutorial 5: User Input Saved To Variables
wxPython Programming Tutorial 5: User Input Saved To Variables
sentdex
9 wxPython Programming Tutorial 6: Multiple Choice Input
wxPython Programming Tutorial 6: Multiple Choice Input
sentdex
10 wxPython Programming Tutorial 7: Adding Static Text and Colors
wxPython Programming Tutorial 7: Adding Static Text and Colors
sentdex
11 wxPython Programming Tutorial 8: Custom Button Images
wxPython Programming Tutorial 8: Custom Button Images
sentdex
12 wxPython Programming Tutorial 9: Tool Bar Items and Sub Menus!
wxPython Programming Tutorial 9: Tool Bar Items and Sub Menus!
sentdex
13 Basic PHP Tutorial 13: Multi-dimensional Array
Basic PHP Tutorial 13: Multi-dimensional Array
sentdex
14 Basic PHP Tutorial 15: Functions and Global Variables
Basic PHP Tutorial 15: Functions and Global Variables
sentdex
15 Basic PHP Tutorial 12: Associative Array
Basic PHP Tutorial 12: Associative Array
sentdex
16 Basic PHP Tutorial 14: Foreach loop
Basic PHP Tutorial 14: Foreach loop
sentdex
17 Basic PHP Tutorial 16: Include and Require
Basic PHP Tutorial 16: Include and Require
sentdex
18 Basic PHP Tutorial 7: Assignment, comparison and Logical operators
Basic PHP Tutorial 7: Assignment, comparison and Logical operators
sentdex
19 Basic PHP Tutorial 4: Variables and Comments
Basic PHP Tutorial 4: Variables and Comments
sentdex
20 Basic PHP Tutorial 11: Arrays part 1, basic array
Basic PHP Tutorial 11: Arrays part 1, basic array
sentdex
21 Basic PHP Tutorial 6: If else and else if conditionals cont'd
Basic PHP Tutorial 6: If else and else if conditionals cont'd
sentdex
22 Basic PHP Tutorial 1: Intro to PHP
Basic PHP Tutorial 1: Intro to PHP
sentdex
23 Basic PHP Tutorial 3: HTML with PHP
Basic PHP Tutorial 3: HTML with PHP
sentdex
24 Basic PHP Tutorial 9: While Loop
Basic PHP Tutorial 9: While Loop
sentdex
25 Basic PHP Tutorial 10: Switch Statement
Basic PHP Tutorial 10: Switch Statement
sentdex
26 Basic PHP Tutorial 2: Print and Echo
Basic PHP Tutorial 2: Print and Echo
sentdex
27 Basic PHP Tutorial 5: If else and else if conditional statements
Basic PHP Tutorial 5: If else and else if conditional statements
sentdex
28 Basic PHP Tutorial 8: Arithmatic Operators: Doing math with php
Basic PHP Tutorial 8: Arithmatic Operators: Doing math with php
sentdex
29 Basic PHP Tutorial 17: User Input Form Example / String Manipulation
Basic PHP Tutorial 17: User Input Form Example / String Manipulation
sentdex
30 Basic PHP Tutorial 18: HTML Entities and forms cont'd
Basic PHP Tutorial 18: HTML Entities and forms cont'd
sentdex
31 Basic PHP Tutorial 19: Finding words in strings
Basic PHP Tutorial 19: Finding words in strings
sentdex
32 Basic PHP Programming Tutorial 20: Saving to a File / writing and appending
Basic PHP Programming Tutorial 20: Saving to a File / writing and appending
sentdex
33 Basic PHP Programming Tutorial 22: Hashing part 2: salting
Basic PHP Programming Tutorial 22: Hashing part 2: salting
sentdex
34 Basic PHP Programming Tutorial 23: Variables in Strings and tokenizing
Basic PHP Programming Tutorial 23: Variables in Strings and tokenizing
sentdex
35 Basic PHP Programming Tutorial 21: MD5 Hashing For Security
Basic PHP Programming Tutorial 21: MD5 Hashing For Security
sentdex
36 Basic PHP Programming Tutorial 24: String similarity
Basic PHP Programming Tutorial 24: String similarity
sentdex
37 Basic PHP Programming Tutorial 25: Time and Time stamps
Basic PHP Programming Tutorial 25: Time and Time stamps
sentdex
38 Basic PHP Programming Tutorial 26: Die and Exit
Basic PHP Programming Tutorial 26: Die and Exit
sentdex
39 Basic PHP Programming Tutorial 27: MySQL Databases Part 1
Basic PHP Programming Tutorial 27: MySQL Databases Part 1
sentdex
40 Basic PHP Programming Tutorial 28: MySQL Database Part 2: Reading From Database
Basic PHP Programming Tutorial 28: MySQL Database Part 2: Reading From Database
sentdex
41 Basic PHP Programming Tutorial 29: MySQL Database Part 3: Inputting Data
Basic PHP Programming Tutorial 29: MySQL Database Part 3: Inputting Data
sentdex
42 Basic PHP Programming Tutorial 30: MySQL database in Use
Basic PHP Programming Tutorial 30: MySQL database in Use
sentdex
43 Django Tutorial Web Development with Python Part 1: Installing Django
Django Tutorial Web Development with Python Part 1: Installing Django
sentdex
44 Python Tutorial: File Deletion and Folder Deletion / directory deletion
Python Tutorial: File Deletion and Folder Deletion / directory deletion
sentdex
45 Python Tutorial: How to Rename Files and Move Files with Python
Python Tutorial: How to Rename Files and Move Files with Python
sentdex
46 3D Graphs in Matplotlib for Python: Basic 3D Line
3D Graphs in Matplotlib for Python: Basic 3D Line
sentdex
47 3D Plotting in Matplotlib for Python: 3D Scatter Plot
3D Plotting in Matplotlib for Python: 3D Scatter Plot
sentdex
48 3D Charts in Matplotlib for Python: Multiple datasets scatter plot
3D Charts in Matplotlib for Python: Multiple datasets scatter plot
sentdex
49 Sikuli Tutorial 1: Visually programming in python!
Sikuli Tutorial 1: Visually programming in python!
sentdex
Sikuli Tutorial 2: Program visually in python!
Sikuli Tutorial 2: Program visually in python!
sentdex
51 Sikuli Tutorial 3: Program visually in python!
Sikuli Tutorial 3: Program visually in python!
sentdex
52 3D Bar Charts in Python and Matplotlib
3D Bar Charts in Python and Matplotlib
sentdex
53 3D Plane wire frame Graph Chart in Python
3D Plane wire frame Graph Chart in Python
sentdex
54 Raspberry Pi Part 1 Introduction
Raspberry Pi Part 1 Introduction
sentdex
55 Raspberry Pi Part 8: First Download and Update! (Firmware)
Raspberry Pi Part 8: First Download and Update! (Firmware)
sentdex
56 Raspberry Pi Part 10: How to set up a Linux Web Server on your Pi
Raspberry Pi Part 10: How to set up a Linux Web Server on your Pi
sentdex
57 Raspberry Pi Part 11: Remote Desktop
Raspberry Pi Part 11: Remote Desktop
sentdex
58 Twitter Analysis: How to rank a user's influence
Twitter Analysis: How to rank a user's influence
sentdex
59 GPIO Tutorial for Pi Part 2 - Programming the GPIO
GPIO Tutorial for Pi Part 2 - Programming the GPIO
sentdex
60 GPIO Tutorial for Raspberry Pi Part 1 - Setting up
GPIO Tutorial for Raspberry Pi Part 1 - Setting up
sentdex

Related Reads

Up next
The Godfather of NYC Investment Sales Just Launched an AI-Driven Brokerage. Here's How.
AI for CRE
Watch →