Python Selenium Tutorial - Automate Websites and Create Bots

  Рет қаралды 182,824

Tech With Tim

Tech With Tim

Күн бұрын

Today i'm going to show you everything you need to know about Selenium so you can get up-and-running as fast as possible. Selenium is a simple yet powerful tool used to create bots, web automation, & more using Python. You will be able to follow along regardless of your current skill level in Python programming.
Get $15 of free credit when you create a new BrightData account: brdta.com/techwithtim-selenium
🎓 Premium Courses 🎓
🏢 CourseCareers - techwithtim.net/dev
🔗 BlockchainExpert - algoexpert.io/blockchain (use code “tim”)
💻 ProgrammingExpert - programmingexpert.io/tim (use code “tim”)
🎓 Free Courses 🎓
📚 Introduction To Software Development: techwithtim.net/dev
🎞 Video Resources 🎞
Code in this video: github.com/techwithtim/Seleni...
Download ChromeDriver: sites.google.com/chromium.org...
Cookie Clickers Website: orteil.dashnet.org/cookieclic...
Install Pygame (Mac): • How to Install Pygame ...
Install Pygame (Windows): • How to Install Pygame ...
⏳ Timestamps ⏳
00:00 | Introduction
01:41 | Installing Selenium
07:50 | Locating & interacting With Elements
10:02 | Potential Problems & Getting Blocked
12:35 | Brightdata Unblocking Solution
17:45 | Clicking Links & Navigating Pages
23:15 | Automating Cookie Clickers - Sample Project
🔗 Socials 🔗
📸 Instagram - / tech_with_tim
🐦 Twitter - / techwithtimm
💬 Discord - / discord
🤝 LinkedIn - / tim-ruscica-82631b179
🌐 Website - techwithtim.net
💾 GitHub - github.com/techwithtim
🔗 Support 🔗
👕 Merch - teespring.com/stores/tech-wit...
💵 Donations - www.paypal.com/donate?hosted_...
🙏 Patreon - / techwithtim
🔖 Tags 🔖
- How to use Selenium
- Selenium python tutorial
- Python selenium web scraping
Hashtags
#python
#techwithtim
#selenium

Пікірлер: 181
@thembekilethembekile5839
@thembekilethembekile5839 5 ай бұрын
It’s been years now and you still manage to release content when I need it the most. You just clutch dude ❤
@HebbenBeeld
@HebbenBeeld 8 ай бұрын
@28:50 If you want to go straight to the html element in inspection (here: the number of cookies), click on the arrow in the dotted square at the top left corner of the inspection window (it'll turn blue) and then click on the element on the webpage you want to find in the html. The inspection window will then take you straight to the html where the element is at. Having said that: great video!
@dfsed1057
@dfsed1057 8 ай бұрын
Love your tutorials. I use xpath quite often when trying to find what to click on. In chrome, when you right click and inspect an element, it brings up the page source. Then if you right click the item that you are looking for, you can copy the xpath and paste it in your program as well.
@adesinapsalmlord7305
@adesinapsalmlord7305 7 ай бұрын
I really love Tim tutorial for it conciseness and Simplicity Thanks for always serving us the best
@spazztik
@spazztik 5 ай бұрын
Been trying to figure out this for the last 2 days and could only find outdated and irrelevant videos. This video was really what i needed and even more. Props to you bro!
@jeeadvanced4719
@jeeadvanced4719 5 ай бұрын
Bro what you trying automate?
@AshokanandChaudhary786
@AshokanandChaudhary786 5 ай бұрын
Have you found more videos about the slenium?
@cbacca2999
@cbacca2999 Ай бұрын
When I search YT or Google I always set my search to find stuff in the last year only.
@luisemilioogando
@luisemilioogando 8 ай бұрын
Great one, this is what i'm looking for, Automation, web scraping, bots, pytho automation, Qa automation.. Thank you so much. You are amazing.
@luisfcocontreras
@luisfcocontreras 8 ай бұрын
You should do an updated selenium series 🔥 would love that, some automation testing for things like SDET or QA
@EzraKoenigsberg-hn9pk
@EzraKoenigsberg-hn9pk 2 ай бұрын
Great video! Been looking for something that explains this process for a while.
@alexurrutia6495
@alexurrutia6495 7 ай бұрын
Your tutorials are clutch man, thank you for all the knowledge!
@Ohiostategenerationx
@Ohiostategenerationx 4 ай бұрын
Great tutorial. As soon as I get python down pat I am going to watch this video several times because I have lots of sites I could automate.
@garrettsmith315
@garrettsmith315 8 ай бұрын
This is excellent, love everything about this!
@MaxTheFireCat
@MaxTheFireCat 8 ай бұрын
I feel nostalgic, I remember watching your selenium series a few years ago
@MohammedSalah2405
@MohammedSalah2405 Ай бұрын
What makes me feel suspecious about the comments is that I hardly find anyone facing an issue, while if you're following the same steps you WILL definitely face issues with the code. But the comments section is full of angels
@zen1818
@zen1818 Ай бұрын
I'm sure they are not real people
@CalmCabezonFish-nb6qt
@CalmCabezonFish-nb6qt Ай бұрын
For your kind information, most people watch this to just have an overview of how it works. For development docs are available officially
@bennikllr5509
@bennikllr5509 8 ай бұрын
thanks, wanted to do this yesterday and kinda messed it up. (the old videos to selenium and the new driver) now everything works fine
@carlitosvh91
@carlitosvh91 8 ай бұрын
This was very helpful. Thank you very much.
@alimihakeem841
@alimihakeem841 14 күн бұрын
Thanks for this great content. I love the way you explained in details
@sixthsense844
@sixthsense844 8 ай бұрын
More selenium tutorial please, keep up the great content
@georgekamakia7591
@georgekamakia7591 8 ай бұрын
great!!, thanks for the tutorial just what i needed
@AsuGhimire
@AsuGhimire 8 ай бұрын
DUDE I NEEDED THIS AND YOU JUS UPLOADED IT XD
@seomaster7171
@seomaster7171 Ай бұрын
Спасибо за подробный разбор, новая связка на отлично. Два круга, все сработало!
@itstechshow7747
@itstechshow7747 8 ай бұрын
You are a genius 🔥 Your effort is remarkable ❤
@ColeHillyer
@ColeHillyer Ай бұрын
Excellent lesson thanks for explaining each step
@parsakei9006
@parsakei9006 3 ай бұрын
Great tutorial sir, thank you.
@BikerBoyz7
@BikerBoyz7 Ай бұрын
Nicely explained thanks Tim
@vascomarques2380
@vascomarques2380 7 ай бұрын
LETS GO, UPDATED VIDEOOO
@samurai317
@samurai317 8 ай бұрын
Thank you so much for this.
@akrammohamed8374
@akrammohamed8374 Ай бұрын
I LOVE YOU TECH WITH TIM
@fernandomartino4708
@fernandomartino4708 8 ай бұрын
Hi, Tim. Wouldn't be easier to use webdriver_manager library where it gets the last version of the driver to match the browser you have installed? because everytime you have a version upload you have to download it and retest this?
@jabirmustafasulaiman5147
@jabirmustafasulaiman5147 8 ай бұрын
Wonderful project❤
@bisyrim1030
@bisyrim1030 7 ай бұрын
also you can use driver.implicity_wait(10) instead of time.sleep(10)
@fatimanoor2497
@fatimanoor2497 8 ай бұрын
Thanks Tim bro😊😊😊
@repairstudio4940
@repairstudio4940 8 ай бұрын
Selenium = fun with Tim 🎉
@richardsifeanyi6766
@richardsifeanyi6766 8 ай бұрын
Thanks for sharing 🙏
@artabra1019
@artabra1019 7 ай бұрын
Thanks for your selenium tutorials I have made 20k$ earnings as freelancer web scraping in Upwork.
@Chettahsofiane
@Chettahsofiane Ай бұрын
علمني معك اريد ان اربح معك 20 الف دولار اخي
@jocois
@jocois 5 ай бұрын
Does anyone know how to have the browser open with the default account? Mine always opens without it and its an issue, especially with SSO.
@alexurrutia6495
@alexurrutia6495 6 ай бұрын
I know that this may be asking for a lot, but could you make a tutorial on how to run parallel testing with selenium and pytest? Or whichever other tools you think are better for running multiple test cases at once?
@rverm1000
@rverm1000 8 ай бұрын
wow thats so cool. i can use that.
@VoidTailor
@VoidTailor 8 ай бұрын
great content!
@RohxnYadav
@RohxnYadav 4 ай бұрын
Fucking Great Video My Man, I have been getting errors everytime when i try to get the selenium working... after watching this video i solved my problem and its workingggg.
@nurdinmoha3505
@nurdinmoha3505 8 ай бұрын
You are the BEST
@py_world
@py_world 4 ай бұрын
I would like to do this with brave browser which is also based on chromium, chromium version my brave instance is 122 while the downloaded version of the chrome driver is 123, I am unable to get driver version 122 nor am I able to update the brave browser. (win64)
@benasmaciulaitis3292
@benasmaciulaitis3292 Ай бұрын
Somewhy, when I run the ''python main.py'' command in terminal, I don't get anything, chrome doesn't start, nothing happens, at all.
@user-gl9ul5is6o
@user-gl9ul5is6o 4 ай бұрын
i love this guys
@MelTrades
@MelTrades 7 ай бұрын
Hey Tim how do i fix it if chrome driver is 120.0.6099.62 but mine is 120.0.6099.63
@doug8487
@doug8487 5 ай бұрын
Hopefully this helps someone, I was having issues around 28:24 and getting the following error: "Message: stale element reference: stale element not found". This seemed to be because the page would load after clicking the language? I added time.sleep(5) to the line before finding the cookie and it solved the error. I'm not sure why the WebDriverWait function wasn't working as intended though, I'm assuming it was finding the cookie after the language was pressed but due to the loading screen popping up, Selenium ended up losing the cookie and errored out?
@andyliu4890
@andyliu4890 4 ай бұрын
that worked for me!
@shawntiaw
@shawntiaw 5 ай бұрын
Hi Tech With Tim, i follow your tutorial and it works super fine! learn some basic from you but i encounter some issue. how to use if and else if i want a button to be clickable. if not clickable then auto refresh until it become clickable?
@user-wu4ip7mp3z
@user-wu4ip7mp3z 3 ай бұрын
Just a question, instead of waiting for 5seconds for the elements to exist. Can you implement some kind of a loop to keep searching for the element until they do exist? Would this best be done with a while loop, and what would it look like?
@cristianionut9885
@cristianionut9885 7 ай бұрын
Hello. I am a beginner and I use VSC as well. For some reasons, when I run the exactly same code you typed, it opens my chromedriver without accessing the link. Why is that?
@top3model
@top3model 6 ай бұрын
hi Im getting this error when trying to install chrome driver, Google-Edge-Cache: forbidden Error: 7 please help me with it
@rudyruderabbit
@rudyruderabbit 4 ай бұрын
nothing is happening when i try run google. i dont see selenium on the top left as you have, but it was innstalled...im stuck
@ZoonCodes-er1rb
@ZoonCodes-er1rb 7 ай бұрын
Thank you.
@MrIncredible-mu5ec
@MrIncredible-mu5ec 8 ай бұрын
One question still remains: how to upload Selenium to a remote server and run it? For me, it's #1 reason why I try to avoid using Selenium.
@architech5940
@architech5940 8 ай бұрын
Create an API for your selenium script and host it on a linode instance. There are tutorials for both.
@moumnalmunawy1806
@moumnalmunawy1806 8 ай бұрын
So what do you use?
@gustavojuantorena
@gustavojuantorena 8 ай бұрын
You can use a docker container. There is containers with selenium already installed.
@brentfiegle9761
@brentfiegle9761 8 ай бұрын
Look at AWS CloudWatch Synthetics. It can use selenium and save the screenshots, run on a schedule and alert you if the tests start failing.
@ikennamanagwu9646
@ikennamanagwu9646 7 ай бұрын
Using a Linux server is doable but much more complex
@chetanpatil2473
@chetanpatil2473 6 ай бұрын
hey some one help me i try to make my router restart using this libarary but it wont work it stuck and show error while confirmation windos not popup and i try everything but it wont work why ?/ any soluction for this
@memeshouse8621
@memeshouse8621 5 ай бұрын
when try to login into gmail it says "could nkt sing in , browser not secure" how to solved it?
@MdRihab-ob5zk
@MdRihab-ob5zk 4 ай бұрын
Thanks Brother
@phaedrus2633
@phaedrus2633 8 ай бұрын
You go way too fast for this 65-year-old brain, but I understand, a slower pace would be boring for young programmers. But for the first time, I have a handle about the concepts of web scraping. You are using the Selenium Python library to bot web surfing. Too cool!
@Alien-by3gb
@Alien-by3gb 26 күн бұрын
If u 65 why u coding?
@phaedrus2633
@phaedrus2633 26 күн бұрын
@@Alien-by3gb It's a hobby of mine, ever since PCs hit the market. I remember when Apple IIs were the rage. I've been messing around with programming ever since.
@rajagam5325
@rajagam5325 Ай бұрын
thank you
@user-ps2zr5lh8q
@user-ps2zr5lh8q 5 ай бұрын
Is no one else getting ElementNotInteractableException: Message: element not interactable?
@oblivion7300
@oblivion7300 6 ай бұрын
can someone tell me where he got the class gLFyf because i didnt see it
@jdoublea2023
@jdoublea2023 3 ай бұрын
Just wondering if anyone else has been trying to get past the collect data popup that appears when you directly open google using this method I cant interact with the search bar
@justgoto8
@justgoto8 4 ай бұрын
one thing I'll add in here, you need to open the driver before selenium can actually use it. I was getting errors of selenium not being able to find the driver even though my route was correct. as soon as a double clicked on the driver file and opened it, selenium was able to open the browser. I use MAC
@oluwatosinoseni5413
@oluwatosinoseni5413 8 ай бұрын
Does selenium still need us to install the drivers, i thought its now installed with the selenium 4.10
@FlockofSmeagles
@FlockofSmeagles 4 ай бұрын
I'm wanting to run a bot for an agency that my wife works for. Urgent shifts pop up fairly often. But, from what I suspect. Someone else is running a bot and snapping them up before she can get to them. I'd like to combat that, but there's no way to be sure. What I'm wanting to know is if there any way to detect whether or not the agency can detect bot activity. Since her ID is connected to the account. I won't be able to just spoof my IP. Any help would be appreciated.
@sajidghanchi7591
@sajidghanchi7591 2 ай бұрын
Hey can someone please help me I am desperately looking to resolve this issue. I want to perform the same task but in my regular chrome browser instead of testing browser. Will it be possible? If yes then how?
@AmirRTR
@AmirRTR 5 ай бұрын
Big video ❤
@Hotshot24-7
@Hotshot24-7 24 күн бұрын
What’s the point of creating the service object if when you create the driver object the browser still opens when running the code from the IDE?
@REALANSHUMAN
@REALANSHUMAN 3 ай бұрын
hello sir , i have no experience of coding . how can i learn to make automation bots or integrating api (i dont know what this is but it pays good on upwork ) ? how long do i need to learn it ? I need to come up with money by the end of july for my moms surgery
@johnmantzanis1213
@johnmantzanis1213 3 ай бұрын
what if the ID and class names are changing every time you log in to the website?
@jaschyns
@jaschyns 4 ай бұрын
I dont know where my selenium folder is man, i installed it through Pycharm.. dont know the default location.
@Dominichii7
@Dominichii7 Ай бұрын
Do I have to update the chrome driver every time Google updates actual Chrome?
@diegoho4885
@diegoho4885 Күн бұрын
I can't use the driver since my Mac displays an error saying it can't verify that this app is free from malware. Has anyone had that issue?
@mubeenahmed5622
@mubeenahmed5622 Ай бұрын
is it possible to make a robot that monitor a website name BLS international visa embacy and robot notify me when appointment date are available???
@user-ts5ku2il8b
@user-ts5ku2il8b 2 ай бұрын
thanks bro
@PhunkyBob
@PhunkyBob 8 ай бұрын
Thank you for your videos! I love them. When I make a comment adding information based on my experience, it's always suppressed. What is the reason? For instance here I commented about a Python module helping with drivers installation.
@TechWithTim
@TechWithTim 8 ай бұрын
Not sure if you add a lot of logs or code KZbin might think you’re a bot
@joshuawiley6506
@joshuawiley6506 7 ай бұрын
Hi there, I'm having a major issues with my paths, I've added the driver to the PATH, I've pinpointed it specifically using an exact path, and a local path...still, it doesn't find the chrome driver. Message: unknown error: cannot find Chrome binary Stacktrace: It's been plaguing me and stopping my progress on every tutorial....please help! Thanks!
@AstraGamesStudios
@AstraGamesStudios 6 ай бұрын
still having issues with this?
@yassinehsouna5425
@yassinehsouna5425 5 ай бұрын
i cant find the same version of the webdriver
@RIFADOR001
@RIFADOR001 7 ай бұрын
I tried to use the chromedriver in mac but it says No such file or directory: 'chromedriver' I have the file in the same directory, it has the name of the file, I used os.system("ls -l") to verify that the file is in the folder where the program is running but it doesn't matter... Do you have any suggestion?
@hakouthegamer7978
@hakouthegamer7978 6 ай бұрын
Hey i had the same issue on windows, there is a library called seleniumbase and it autodetects chrome version and gets you the right chromedriver, i used it and it works instantly
@yangsong6111
@yangsong6111 4 ай бұрын
I tried the full path and it works.
@jm27925
@jm27925 2 ай бұрын
@@hakouthegamer7978 thanks for this. this resolved the issue for me in seconds.
@dogukantaytuglu
@dogukantaytuglu 2 ай бұрын
@@yangsong6111 thanks!
@SatoOnAir
@SatoOnAir 10 күн бұрын
Guys why is the "stale element not found" error automatically fixed itself? I meet this bug muptile times and dont know why it can fix itself everytime i rerun the program
@jaouadbenji7088
@jaouadbenji7088 15 күн бұрын
Help : when i try to click on a element the browser just closed and the programme stops
@ima6683
@ima6683 6 ай бұрын
I came to look for copper and I found gold. thanks for the video. you saved me. I hate pychar. I love vsc.
@makobobinzers
@makobobinzers 2 ай бұрын
is there a free alternative to brightdata?
@noobCoder7
@noobCoder7 5 ай бұрын
how to handle if div is used as textfield
@Rahul_Singh_Rajput_04
@Rahul_Singh_Rajput_04 6 ай бұрын
Thank you For saving my time
@mahapeyuw5946
@mahapeyuw5946 5 ай бұрын
service=service didn't run. It gave me a traceback error.
@esat0_090
@esat0_090 8 ай бұрын
tim whats your vs code settings for syntax colors I've tried some methods but none of them was working for example (ctrl + K + T) can you make a video about that or if you already have one tag me please
@jayshreedhurve9313
@jayshreedhurve9313 7 ай бұрын
Monokai syntax theme
@hongzhisui
@hongzhisui 6 ай бұрын
Hi Tim, thanks so much for putting the tutorial out there. I noticed that when I typed in executable_path, it gave me an error message (unresolved reference) for some reason?
@doug8487
@doug8487 5 ай бұрын
Did you put chromedriver.exe in the same folder as your .py file?
@jakemcardle1936
@jakemcardle1936 3 ай бұрын
I'm having an issue at 11.05 when google opens I get a pop-up asking to accept/decline cookies, because of this "the tech with tim" doesn't get inputted, instead the window with google closes immediately. Do you know how I can stop that pop-up from showing?
@Tortexxxx
@Tortexxxx 16 күн бұрын
Did u get answer?
@FatihMumtaz-tt5to
@FatihMumtaz-tt5to Ай бұрын
if i have do it and nothing changes , what's wrong??? its not opened the chrome.....
@alexicek011
@alexicek011 8 ай бұрын
It doesn't work for me :( , after launching the browser I see info about accepting or rejecting cookies and I can't get to the search element .Error > selenium.common.exceptions.ElementNotInteractableException: message: element not interactable
@dfsed1057
@dfsed1057 8 ай бұрын
this will happen when a popup window blocks the element that is trying to be clicked. i think he had the similar thing when the language popup occured for example.
@ElParacletoPodcast
@ElParacletoPodcast 6 ай бұрын
Thanks, but my Mac mini won;t let me run that file!
@kayoutube690
@kayoutube690 2 ай бұрын
Is this working if the app is saml integrated??
@Agnarr_Valhalla
@Agnarr_Valhalla 5 ай бұрын
What do i do if chroome cookies consent block me from doing anything ?
@Agnarr_Valhalla
@Agnarr_Valhalla 4 ай бұрын
Btw i solved it myself, u search by xpath instead of class. You input the declines button xpath and then also a time.sleep(2) so the cookies have time to load properly
@goldcandles
@goldcandles 2 ай бұрын
Can i make option with bot doing order according to telegram channel
@nguyeninhan8542
@nguyeninhan8542 Ай бұрын
Nice
@shreyaschavan7976
@shreyaschavan7976 7 ай бұрын
can't we just use 'from selenium import * '?
@Tortexxxx
@Tortexxxx 16 күн бұрын
How u disabled asking about cookies?
@weistrass
@weistrass 2 ай бұрын
Can it run on background?
@thegodstudent
@thegodstudent 8 ай бұрын
Cool
@samson6707
@samson6707 5 ай бұрын
not sure why you do this extra step of downloading a webdriver and including it with Service instead of just using webdriver Chrome without the service parameter
@moisespereire9528
@moisespereire9528 7 ай бұрын
Good afternoon, your video is very good and helped me a lot but I want to know how I make my vscode terminal the same as yours? How do I configure my Vscode terminal to look like yours?
@elmundoennumeros405
@elmundoennumeros405 6 ай бұрын
It's standard, you can check your python interpreter (down right)
@moisespereire9528
@moisespereire9528 6 ай бұрын
​ Hello, sorry, but once again, it's not standard, my friend, your terminal has tabs and these tabs are not standard, how do I make my terminal the same as yours with tabs, what configuration did you do? Is there a video or document showing how to do this?
5 Mini Python Projects - For Beginners
1:41:08
Tech With Tim
Рет қаралды 2,8 МЛН
Easily Automate Business Tasks - No-Code Automation Course
3:00:39
freeCodeCamp.org
Рет қаралды 142 М.
A little girl was shy at her first ballet lesson #shorts
00:35
Fabiosa Animated
Рет қаралды 14 МЛН
КАК ДУМАЕТЕ КТО ВЫЙГРАЕТ😂
00:29
МЯТНАЯ ФАНТА
Рет қаралды 10 МЛН
Selenium Headless Scraping For Servers & Docker
16:22
NeuralNine
Рет қаралды 27 М.
The most important Python script I ever wrote
19:58
John Watson Rooney
Рет қаралды 175 М.
Web Scraping 101: A Million Dollar Project Idea
13:07
Tech With Tim
Рет қаралды 549 М.
Game Automation with YOLOv8: Python Bot Tutorial
21:40
ClarityCoders
Рет қаралды 26 М.
3 Python Automation Projects - For Beginners
41:38
Tech With Tim
Рет қаралды 50 М.
Selenium Browser Automation in Python
21:38
NeuralNine
Рет қаралды 209 М.
7 Years of Software Engineering Advice in 18 Minutes
18:32
Automate your job with Python
6:07
John Watson Rooney
Рет қаралды 386 М.
A little girl was shy at her first ballet lesson #shorts
00:35
Fabiosa Animated
Рет қаралды 14 МЛН