Al Sweigart, "Automating Your Browser and Desktop Apps", PyBay2016
Вставка
- Опубліковано 29 вер 2024
- There's a lot of data on the web and in your desktop apps, but accessing it can involve a lot of tedious typing and clicking. This talk is an introduction to the Selenium and PyAutoGUI modules, with live demos straight from the interactive shell. Al Sweigart explains web scraping techniques and programmatically controlling the keyboard and mouse to automate these tasks for you.
Abstract
The internet and personal computer are central tools in many jobs, including professions outside of engineering. This makes web scraping and GUI automation are relevant to not just developers and QA testers, but academics, organizers, and office workers. This talk is an introduction to Selenium and PyAutoGUI modules. and programatically controlling your browser and desktop applications from Python.
Web scraping and GUI automation frameworks have an intimidating reputation for a steep learning curve. While they do have many sophisticated features, the basics that most folks will ever need can be covered in a single presentation.
This presentation has multiple live demos to showcase these modules straight from the interactive shell.
The content from this talk is derived from Automate the Boring Stuff with Python, a beginner's Python book freely available under a Creative Commons license at automatethebor...
Bio
Al Sweigart is a software developer and the author of Automate the Boring Stuff with Python, Invent Your Own Computer Games with Python, Making Games with Python & Pygame, and Hacking Secret Ciphers with Python. These books are freely available under a Creative Commons license at inventwithpyth.... Al enjoys haunting coffee shops, writing educational materials, cat whispering, and making useful software. He lives in San Francisco.
speakerdeck.co...
This is my very humble teacher.
I leant virtually everything I know in python from him.
True
I owe this man everything... I learnt how to code from his book, 'Invent Your Own Games With Python' back when I was a kid.
I highly recommend his book. It got me back into programming after a 17-year hiatus.
You encourage me as well. I felt dummy on programming.
For us beginners watching in 2022, at the 6:30 minute mark the selenium commands are out of date. It now looks like: driver.find_element(By.ID," "). Here's a recent short tutorial video with the new commands: ua-cam.com/video/p24C_0d8FcQ/v-deo.html&t
"Hi, I'm AI." Whoa! That's some good AI. At first I was convinced you were an organic human.
Just felt happy by seeing below letter on your laptop. There is meaning for below letters.
ಠ_ಠ. ಠ is one of the Consonant letter in Kannada Language.
Thank you Al for your videos, This was very helpful
Clear, concise, simple. Thank you.
Grate demo by you. Can you resolve auto search multiple, word from checklist and highlight in word. And reverse check whole document against list and highlight in list. This will be most useful for researchers. Fro cross check this task manually takes many days for 500 pages. Your help will be much valuable to me and to the world.
Do it yourself.
Now i can practice programming while playing games! will flash games :(
how would you search for certain information in a page source with sellenium? like an url
Very good video. I wanted to use Pyautogui to automate my desktop application. It works fine with pyautogui. I wanted to know how I can get the test results logged to a report or something with a Pass or Fail. I also like to know whether I can use a Test Framework for this using pyautogui.
Thanks
How to install PythonAutoGui in Python 3+ (Anaconda environment)?
Hii..sir how to work with function keys(f1,f2...etc)
Please help me out with this.
I wanted to block web sites on chrome after analyzing the content of web page by python
it is possible
no
On my Mac , how to get the selenium installed? what IDE to use?
U can use python idle terminal....
Just type.. pip3 install selenium for Mac
Wow
who all are watching in 2020
or just get macroscheduler
It *is* pronounced \ sə-ˈlē-nē-əm \. That's dumb.
AI is getting me really interested in learning Python.
Look I'm not the one to write replies or even reviews, but I can't help myself after discovering this man and reading your comment. I was on /r/python on reddit, looking into what resources were out there to start learning. I came across MITs OCW program and figured what a blessing...and MIT education for free. I went through about 3-4 lecture's before going back on the subreddit and came across someone mentioning his book "How to automate the boring stuff."
If you've ever asked yourself where to get started on learning how to code, sign up for his course on Udemy. It's $10 if you use his discount code on www.automatetheboringstuff.com. If you are unable to afford that, you can read the text for free. He does move very quickly through the video's but he makes it SO easy to understand. What took me a week with the MIT course, I learned in a few hours with Al.
I am amazed that this man is not the face of coding in general. Do yourself a favor this year and sign up, you will get lifetime access. I started today and am already halfway through his course. I never would have thought it was this easy nor would I be this intrigued. Thanks, Al.
python = plain english
It's the reason I program in Python
Same
I have installed Python and PIP correctly, all showing up in the CMD, updated and everything. Installed selenium using PIP, fully set and everything, even in the python folder, it's showing up.
Though, after all of that, the python script does not run properly and shows this as the error message. Any help would be appreciated!
Code >
from selenium import webdriver
driver = webdriver.Chrome()
Error Message >
Traceback (most recent call last):
File "C:/Users/MyName/PycharmProjects/Test project/Test Script Selenium.py", line 1, in
from selenium import webdriver
ModuleNotFoundError: No module named 'selenium'
I assume that you are running Python 3.x
As a mac user, I know that any command where you want to affect Python 3.x instead of saying python you say python3.
So try running pip3 install selenium.
Great video. After I watched this I got the motivation to really dig in to both selenium and pyautogui and I have already automated so much.
I've just built a program to extract FX data automatically from MT5 using this PyAutoGUI. It took about 2 hours to write the code as there are no keyboard short cuts in the popup window. Works like a charm. It 'automates the boring stuff', as I need to do this task monthly! thanks Al
My very first programming class used one of his books as a textbook called "Invent Your Own Computer Games with Python." I just recently started using pyautogui and literally just found out he also wrote it. Pretty low-key humble guy.
how did no one laugh at 1:58?
@Bigtombowski :)
the nerds were trying to fix the issue
I don't understand how nobody laughed at 0:28
because they we disappointed it didnt work and he was poorly prepared
Hello pyAutoGui wrote this comment for me
This man's voice is really soothing.
I thought the same too.
Me too!
It makes me feel good about life.
I used to hate coding before reading Automate Boring stuff with Python, it was fun though and Now I am watching videos on Selenium!! thank you, Mr. Albert, for making fun from boring bits!!
Currently doing this course. Regex is a b*tch though. Looks as if i let my cat walk around on my keyboard.
Al Sweigart, Hero. Thank you for writing such an awesome book(s)!
Selenium just gave me a litany of errors with browser = webdriver.anyfuckingbrowser()
hahahahaaha
Instructions for installing, for those who are beginning with pyautogui: Go to pypi.python.org/pypi and search for "pyautogui" from there download "PyAutoGUI-0.9.36.tar" then (if not already) drag to download files (easy way for me)from the left side of file explorer, then Left shift-right click on downloads then click on "open command window here" then type where you have your python file (bear in mind that it only works well on python versions that are 3.4 or lower) e.g C:/python27/Scripts/pip install py(press tab) then once the full name pops up ("PyAutoGUI-0.9.36.tar") press "Enter" on your key board, it should be installing/downloading from there(it usually takes a minute or two on a slow system)
This is for windows but other users should get an idea of what they should do with this info.
Wow! he wrote the Automate the Boring Stuff! That's my favorite book, I don't think I'd be here if I didn't read that book haha.
"Selenium" sounds like a "group-2 element"
Beryllium-Magnesium-Calcium-Strontium-Barium-Radium
Selenium...
Look at the element with atomic number 34 on the periodic table
Awesome guy. I love people that legitimately want to help others learn with few or no strings attached.
Thanks for the free book, i lost my job so free stuff helps ^-^
Your book is awesome.,.
very nice tool, but there's pywinauto that works directly on win controls.
PYwinauto is windows only. He wanted something cross platform.
I love python so much. So much to learn in it yet so much fun to learn. It’s simple, sweet, efficient and fun to use. I was so interested in front end but now I’m basically sold on being a backend with python or an engineer in general rocking python in my career
Is it actually pronounced "goo-ee"? I always pronounce it "gwee". Or just "jee, yoo, ai", if i'm trying to sound technical.
Hunter Lee: I’ve only ever heard it as he used it. Personally my brain spells it out when I read/say it.
It's "jee yoo ai" but people call it "goo ee" because it's shorter and easier to say
Al thank you so much for making PyAutoGui. You're a real hero.
I liek autocorrect
Great book. Great talk. What kind of person "thumbs down" this video? I hope you choose to pass on more of your knowledge in such a manner. You are a very good instructor. Thank you!
Thought I'd mention this since this the talk covers browser and desktop - it would be nice to use same API/protocol to automate both cases. You can for some stuff on Windows with MS WinAppDriver. I would think it would make a better integration with Selenium to have a JSONWireProtocol wrapper for PyAutoGUI. Can based off my work for a similar Python tool: github.com/daluu/autopydriverserver
Al, you are an amazing teacher! Thank you.
Great talk!
I expected Al Sweigart to be a 50 year old guy with a beard for some reason!
Thank for the great info, I'm just learning Python and found this and got it working. I'll be looking at your book.
I use AutoIt to automate the boring stuff, but only for Windows and it can be used to scrape stuff from the internet as well, not to be underestimated one can also create fully fledged GUI's. To avoid mouse move/click and sorcerers apprentice phenomena autoit is able to locate Windows program controls and programmatically activate them.
I would highly recommend his book, I bought it and its simple to follow and read.
His book is killer! One of my all time favorites when I'm trying to show someone why they should be interested in Python.
Which book ?
Please mention name ?
@@ayeshavlogsfun Automate the boring stuff with Python
i just use mouse recorder pro and google spreadsheets ;)
www.reformations.co.uk
I made a script with pyautogui that clicks the like button on this video automatically.
Is Selenium a bad idea for long term progress as a programmer since it shields you from learning harder stuff?
This guy is awesome, i just don't see how either tool is useful in a work environment.
somehow webdriver.Chrome() doesnot work, undefined Chromedriver. Even if i add path to chromedriver it does not work.
i sometimes forget to browser. get( " ")
super cool talk. Selenium looks awesome. will be trying it out. Thanks!
Great talk. There is an interesting live demo using MS Paint at time 17:30. Do not miss it.
U r awesome sir love that. Tnx for those all u done with python using selenium and pyautogui. It's help me a lot to get deep into python. Make more videos related this. I'll be greatful to you.
"Hi I'm AI" - Oh, stop being so obvious lol
If. Check. Light blink in web game. How to check?
why the hell would anyone want to control a browser with code and not with a mouse?
autohotkey is a bestest tools. It have a lot of commands . and Free
To load the webdrivers, I've installed selenium from PIP. It gets successfully installed
C:\Users\U0172087>pip show selenium
Name: selenium
Version: 3.0.2
Summary: Python bindings for Selenium
Home-page: github.com/SeleniumHQ/selenium/
Author: UNKNOWN
Author-email: UNKNOWN
License: UNKNOWN
Location: c:\users\u0172087\appdata\local\programs\python\python36\lib\site-packages
Requires:
also installed virtualenv [Not sure if it was needed soon after pip selenium install]
C:\Users\U0172087>pip show virtualenv
Name: virtualenv
Version: 15.1.0
Summary: Virtual Python Environment builder
Home-page: virtualenv.pypa.io/
Author: Jannis Leidel, Carl Meyer and Brian Rosner
Author-email: python-virtualenv@groups.google.com
License: MIT
Location: c:\users\u0172087\appdata\local\programs\python\python36\lib\site-packages
Requires:
Got Error after import webdriver command on Python IDLE 3.6 version
>>> from selenium import webdriver
>>> browser = webdriver.Chrome()
Traceback (most recent call last):
File "C:\Users\U0172087\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\common\service.py", line 74, in start
stdout=self.log_file, stderr=self.log_file)
File "C:\Users\U0172087\AppData\Local\Programs\Python\Python36\lib\subprocess.py", line 707, in __init__
restore_signals, start_new_session)
File "C:\Users\U0172087\AppData\Local\Programs\Python\Python36\lib\subprocess.py", line 990, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "", line 1, in
browser = webdriver.Chrome()
File "C:\Users\U0172087\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 62, in __init__
self.service.start()
File "C:\Users\U0172087\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\common\service.py", line 81, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see sites.google.com/a/chromium.org/chromedriver/home
Can someone point what is wrong here?
THe location C:\Users\U0172087\AppData\Local\Programs\Python\Python36\Lib\site-packages\selenium\webdriver\chrome
has ' _init_.py, options.py, remote_connection.py, service.py and webdriver.py plus _pycache_ folders
Thanks
I think you need to download the chrome driver & pass the path in webdriver.Chrome("path here"). Note that chrome driver extension is not .py
you could use urllib3
I liek the attention to detail as well. Its my favourite part.
Someone should automate or facilitate the process of writing documentation. It's like just give up multiple example of whatever your trying to teach in some source code or something. I mean at least throw the student a bone on where the student can start teaching themselves. Human beings are computers too. This guy is a cool teacher though.
No matter what else was said, I can't get over how he pronounced it heighth at 23:43
> bots are evil and terrible and need to be stopped > bots are integral to the internet.
what should I do. to install them? this " pip install pyautogui" and " pop install selenium" dont work
@@advaitvariyar thank you. I installed pip test and it works now
I think it can be usefull to trace pictures in illustrator from normal drawings using OPEN CV :D
Bought his book. Have to start reading it.
Happpy New Year Everyone! Coding is my resolution for this year. Unfortunately Im stuck with displayMousePosition at 14:50 (mouseNow.py in his book page 419). Can anyone see what's wrong with my code? Thanks.
import pyautogui as pyauto
print("Press Ctrl-C to quit.")
try:
while True:
#Get and pring the mouse coordinates
x, y = pyauto.position()
positionStr = 'X: ' + str(x).rjust(4) + ' Y: ' + str(y).rjust(4)
print(positionStr, end = '')
print('\b' * len(positionStr), flush = True)
except KeyboardInterrupt:
print('
Done.')
I also learnt python from this book..
🤖
And today's I'm a python Django developer
.
I finished your book today it was one of the greatest book I've ever read, Thank you for this amazing book.❤❤❤
...I' really like the attention to detail that programming required", and miss type Like as Liek, what a legend!!, pretty sure was on purpose.
Al is an excellent teacher!
Thanks, I really enjoyed this talk, a remember me to have fun and remove from my mind the cliché of "everybody should learn to code".
AutoHotkey does everything I want, but man is the syntax atrocious and incoherent. It's like they tried their hardest to create a new scripting syntax for each function available.
Firefox 45 and Selenium 2.53.1 will work with auto-install. Took me two days to figure it out! Windows 10 Python Firefox.
I was trying to do some desktop automation with tools like pywinauto... It was h a r d. With pyautogui I achieved what I needed literally within 5 minutes... Thanks Al!
Hi, i have been playing around with pyautogui and selenium with python and also completed an automation project for sap but i could not figure out as to how run the pyautogui script in background, that is I am unable to do some other activity while the script runs. Is there any solution?
O this guy yaaa saw how book for years
How to use it with google docs?
Putting everything in one package might be OK for the user, but it's kind of terrible for the people who have to maintain the library. Break things up, it will be easier to maintain.
protect this guy at all costs!
is it good if i watch in now in 2021 ?
Says your book is freely available? But I only see buy buttons on there
Bret Hagen It is. Just look up "Automate the boring stuff with python PDF" and it'll show up
automatetheboringstuff.com/
Yeah that was great but not working with Google passwords . Please make something useful
Good presentation. You've made some great stuff. I've experimented a bit with pyautogui and I wanted to know if with displayMousePosition is it supposed to return Nan for the RGB values if you use it with extended screens in a two monitor setup?
Started watching this & I'm reading the book without realising this is the author!
Bought Al's books for the simplicity and audience he addresses which is me, hobbyist. Don't want to be a programmer just looking for tools to make my life simpler and not in need of a semester to remember how I did something.
My ideas are easy for me to formulate finding out if there is a way to carry out such an idea not so much.
I am constantly storing away nuggets (URLs) for my review or as reference material, unfortunately, it is rather a labor-intensive to find them based on a simple search (of course unless I have missed some rudimentary method for doing so).
There are times when I can not remember the names of the URL's in question but only basic parts of the subject matter embedded in the reference material.
How does one go about this search with in ones bookmarks(where my nuggets reside)?
does puautogui still work? i just tried to do the thing he shows off at 14:50 but the pip install of pyautogui seems to be broken
Greatest programming teacher.
DoEs pyautogui can read values from desktop app based on objects available in app ?
How do you webdriver.Firefox without getting 10 million lines of error code?
I done Webgui automation on 2014 it has been uploaded in UA-cam. Am expecting more and more flexible way.
If you Ctrl + Alt + Del then it will also stop the program, so in a way this is a hot key to stop all pyautogui programs too.
He looks like Vietnamese
I guess you just changed the comment about up and down codes. But even this way a good lesson
I love his wallpaper. Bet he took that picture himself.