Python Selenium Tutorial - Automate Websites and Create Bots

  Рет қаралды 129,071

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

Пікірлер: 150
@thembekilethembekile5839
@thembekilethembekile5839 2 ай бұрын
It’s been years now and you still manage to release content when I need it the most. You just clutch dude ❤
@HebbenBeeld
@HebbenBeeld 5 ай бұрын
@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 5 ай бұрын
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 5 ай бұрын
I really love Tim tutorial for it conciseness and Simplicity Thanks for always serving us the best
@spazztik
@spazztik 3 ай бұрын
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 3 ай бұрын
Bro what you trying automate?
@AshokanandChaudhary786
@AshokanandChaudhary786 2 ай бұрын
Have you found more videos about the slenium?
@luisfcocontreras
@luisfcocontreras 5 ай бұрын
You should do an updated selenium series 🔥 would love that, some automation testing for things like SDET or QA
@MaxTheFireCat
@MaxTheFireCat 5 ай бұрын
I feel nostalgic, I remember watching your selenium series a few years ago
@luisemilioogando
@luisemilioogando 5 ай бұрын
Great one, this is what i'm looking for, Automation, web scraping, bots, pytho automation, Qa automation.. Thank you so much. You are amazing.
@alexurrutia6495
@alexurrutia6495 4 ай бұрын
Your tutorials are clutch man, thank you for all the knowledge!
@EzraKoenigsberg-hn9pk
@EzraKoenigsberg-hn9pk 2 күн бұрын
Great video! Been looking for something that explains this process for a while.
@bennikllr5509
@bennikllr5509 5 ай бұрын
thanks, wanted to do this yesterday and kinda messed it up. (the old videos to selenium and the new driver) now everything works fine
@artabra1019
@artabra1019 4 ай бұрын
Thanks for your selenium tutorials I have made 20k$ earnings as freelancer web scraping in Upwork.
@Ohiostategenerationx
@Ohiostategenerationx Ай бұрын
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 5 ай бұрын
This is excellent, love everything about this!
@itstechshow7747
@itstechshow7747 5 ай бұрын
You are a genius 🔥 Your effort is remarkable ❤
@sixthsense844
@sixthsense844 5 ай бұрын
More selenium tutorial please, keep up the great content
@georgekamakia7591
@georgekamakia7591 5 ай бұрын
great!!, thanks for the tutorial just what i needed
@vascomarques2380
@vascomarques2380 5 ай бұрын
LETS GO, UPDATED VIDEOOO
@carlitosvh91
@carlitosvh91 5 ай бұрын
This was very helpful. Thank you very much.
@phaedrus2633
@phaedrus2633 5 ай бұрын
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!
@AsuGhimire
@AsuGhimire 5 ай бұрын
DUDE I NEEDED THIS AND YOU JUS UPLOADED IT XD
@parsakei9006
@parsakei9006 29 күн бұрын
Great tutorial sir, thank you.
@fernandomartino4708
@fernandomartino4708 5 ай бұрын
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?
@user-ps2zr5lh8q
@user-ps2zr5lh8q 3 ай бұрын
Is no one else getting ElementNotInteractableException: Message: element not interactable?
@samurai317
@samurai317 5 ай бұрын
Thank you so much for this.
@repairstudio4940
@repairstudio4940 5 ай бұрын
Selenium = fun with Tim 🎉
@jabirmustafasulaiman5147
@jabirmustafasulaiman5147 5 ай бұрын
Wonderful project❤
@alexurrutia6495
@alexurrutia6495 4 ай бұрын
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?
@bisyrim1030
@bisyrim1030 5 ай бұрын
also you can use driver.implicity_wait(10) instead of time.sleep(10)
@fatimanoor2497
@fatimanoor2497 5 ай бұрын
Thanks Tim bro😊😊😊
@richardsifeanyi6766
@richardsifeanyi6766 5 ай бұрын
Thanks for sharing 🙏
@shawntiaw
@shawntiaw 2 ай бұрын
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?
@MelTrades
@MelTrades 5 ай бұрын
Hey Tim how do i fix it if chrome driver is 120.0.6099.62 but mine is 120.0.6099.63
@oluwatosinoseni5413
@oluwatosinoseni5413 5 ай бұрын
Does selenium still need us to install the drivers, i thought its now installed with the selenium 4.10
@user-wu4ip7mp3z
@user-wu4ip7mp3z 15 күн бұрын
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?
@RohxnYadav
@RohxnYadav 2 ай бұрын
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.
@jaschyns
@jaschyns 2 ай бұрын
I dont know where my selenium folder is man, i installed it through Pycharm.. dont know the default location.
@nurdinmoha3505
@nurdinmoha3505 5 ай бұрын
You are the BEST
@user-ts5ku2il8b
@user-ts5ku2il8b 2 сағат бұрын
thanks bro
@doug8487
@doug8487 2 ай бұрын
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 2 ай бұрын
that worked for me!
@rverm1000
@rverm1000 5 ай бұрын
wow thats so cool. i can use that.
@guptaswork1695
@guptaswork1695 5 ай бұрын
TQ for the wonderful content ❤❤❤❤
@TechWithTim
@TechWithTim 5 ай бұрын
It's my pleasure
@guptaswork1695
@guptaswork1695 5 ай бұрын
​@@TechWithTimlearning lot from you ❤😊
@jocois
@jocois 3 ай бұрын
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.
@cristianionut9885
@cristianionut9885 4 ай бұрын
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?
@memeshouse8621
@memeshouse8621 3 ай бұрын
when try to login into gmail it says "could nkt sing in , browser not secure" how to solved it?
@yassinehsouna5425
@yassinehsouna5425 3 ай бұрын
i cant find the same version of the webdriver
@johnmantzanis1213
@johnmantzanis1213 24 күн бұрын
what if the ID and class names are changing every time you log in to the website?
@py_world
@py_world Ай бұрын
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)
@rudyruderabbit
@rudyruderabbit Ай бұрын
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
@MrIncredible-mu5ec
@MrIncredible-mu5ec 5 ай бұрын
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 5 ай бұрын
Create an API for your selenium script and host it on a linode instance. There are tutorials for both.
@moumnalmunawy1806
@moumnalmunawy1806 5 ай бұрын
So what do you use?
@gustavojuantorena
@gustavojuantorena 5 ай бұрын
You can use a docker container. There is containers with selenium already installed.
@brentfiegle9761
@brentfiegle9761 5 ай бұрын
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 5 ай бұрын
Using a Linux server is doable but much more complex
@FlockofSmeagles
@FlockofSmeagles 2 ай бұрын
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.
@RIFADOR001
@RIFADOR001 5 ай бұрын
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 3 ай бұрын
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 Ай бұрын
I tried the full path and it works.
@jm27925
@jm27925 9 күн бұрын
@@hakouthegamer7978 thanks for this. this resolved the issue for me in seconds.
@REALANSHUMAN
@REALANSHUMAN 27 күн бұрын
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
@MdRihab-ob5zk
@MdRihab-ob5zk 2 ай бұрын
Thanks Brother
@ZoonCodes-er1rb
@ZoonCodes-er1rb 4 ай бұрын
Thank you.
@top3model
@top3model 4 ай бұрын
hi Im getting this error when trying to install chrome driver, Google-Edge-Cache: forbidden Error: 7 please help me with it
@user-gl9ul5is6o
@user-gl9ul5is6o Ай бұрын
i love this guys
@VoidTailor
@VoidTailor 5 ай бұрын
great content!
@chetanpatil2473
@chetanpatil2473 3 ай бұрын
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
@PhunkyBob
@PhunkyBob 5 ай бұрын
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 5 ай бұрын
Not sure if you add a lot of logs or code KZfaq might think you’re a bot
@makobobinzers
@makobobinzers 6 күн бұрын
is there a free alternative to brightdata?
@ima6683
@ima6683 3 ай бұрын
I came to look for copper and I found gold. thanks for the video. you saved me. I hate pychar. I love vsc.
@justgoto8
@justgoto8 2 ай бұрын
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
@oblivion7300
@oblivion7300 4 ай бұрын
can someone tell me where he got the class gLFyf because i didnt see it
@ElParacletoPodcast
@ElParacletoPodcast 4 ай бұрын
Thanks, but my Mac mini won;t let me run that file!
@jakemcardle1936
@jakemcardle1936 20 күн бұрын
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?
@sajidghanchi7591
@sajidghanchi7591 10 күн бұрын
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?
@ThatGuyJamal
@ThatGuyJamal 5 ай бұрын
So is this like puppeteer but for python?
@noobCoder7
@noobCoder7 2 ай бұрын
how to handle if div is used as textfield
@mahapeyuw5946
@mahapeyuw5946 3 ай бұрын
service=service didn't run. It gave me a traceback error.
@hongzhisui
@hongzhisui 3 ай бұрын
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 2 ай бұрын
Did you put chromedriver.exe in the same folder as your .py file?
@goldcandles
@goldcandles 3 күн бұрын
Can i make option with bot doing order according to telegram channel
@QuyenNguyen-xq5wt
@QuyenNguyen-xq5wt 17 күн бұрын
I follow the instruction and it does not work for me, it said: ModuleNotFoundError: No module named 'selenium' and I think that I did not install Selenium and had to find another video on how to install Selenium but it does not work for me. Anyone encounter the same issue?
@Rahul_Singh_Rajput_04
@Rahul_Singh_Rajput_04 4 ай бұрын
Thank you For saving my time
@shreyaschavan7976
@shreyaschavan7976 5 ай бұрын
can't we just use 'from selenium import * '?
@jdoublea2023
@jdoublea2023 Ай бұрын
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
@esat0_090
@esat0_090 5 ай бұрын
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 5 ай бұрын
Monokai syntax theme
@Agnarr_Valhalla
@Agnarr_Valhalla 2 ай бұрын
What do i do if chroome cookies consent block me from doing anything ?
@Agnarr_Valhalla
@Agnarr_Valhalla 2 ай бұрын
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
@samson6707
@samson6707 3 ай бұрын
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
@joshuawiley6506
@joshuawiley6506 5 ай бұрын
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 3 ай бұрын
still having issues with this?
@moisespereire9528
@moisespereire9528 5 ай бұрын
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 4 ай бұрын
It's standard, you can check your python interpreter (down right)
@moisespereire9528
@moisespereire9528 4 ай бұрын
​ 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?
@AaronRMG
@AaronRMG 5 ай бұрын
Thanks! I enjoyed learning Selenium. ALTHOUGH, can someone help with my issue? I did exactly what Tim instructed on one computer (ran perfectly), but after sending myself the code to do the same on another computer, I ran into an issue where Selenium states in the terminal that it's "unable to locate or obtain driver for chrome". The driver is the .exe and it's in the same folder. I'm currently trying to figure it out on this second computer but if someone has any tips, I'd appreciate it.
@AaronRMG
@AaronRMG 5 ай бұрын
The terminal points at this line: driver = webdriver.Chrome(service=service)
@AaronRMG
@AaronRMG 5 ай бұрын
I found a solution: to fix it, I made the path to chromedriver.exe an absolute path. I wonder why a relative path wouldn't work on this device?
@AmirRTR
@AmirRTR 3 ай бұрын
Big video ❤
@tilltheend6634
@tilltheend6634 5 ай бұрын
how to disable the pop up page asking to refuse or accept the chart please
@tilltheend6634
@tilltheend6634 5 ай бұрын
great video btw
@marcmuehleisen
@marcmuehleisen 5 ай бұрын
@@tilltheend6634 weird that tim still did not answer this as lots of ppl had this question already
@tilltheend6634
@tilltheend6634 5 ай бұрын
@@marcmuehleisen i had the solution once with chatgpt
@marcmuehleisen
@marcmuehleisen 5 ай бұрын
What did you ask?
@ernestocalzadilla8632
@ernestocalzadilla8632 2 ай бұрын
@02:40 Here the executable_path has been deprecated already. 👍
@SinghAvtar121
@SinghAvtar121 5 ай бұрын
Which vs code theme do u use?
@TechWithTim
@TechWithTim 5 ай бұрын
Monokai
@alexicek011
@alexicek011 5 ай бұрын
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 5 ай бұрын
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.
@bordignonjunior
@bordignonjunior 5 ай бұрын
AttributeError: 'WebDriver' object has no attribute 'get_element' why?
@eyebol
@eyebol 5 ай бұрын
watch 5 more seconds in
@pubgillusiontown5959
@pubgillusiontown5959 5 ай бұрын
May be find elements work
@DECODEDN
@DECODEDN 4 күн бұрын
It tells me elementnotinteractable
@thegodstudent
@thegodstudent 5 ай бұрын
Cool
@karlybyrd1551
@karlybyrd1551 3 ай бұрын
It's a little disappointing knowing how difficult it is to avoid detection and all the extra steps you have to take. I have to login to our work website once a day to check some boxes, so I wanted to just automate that boring task and was excited about figuring it out, but now knowing I'll probably get blocked for being a bot really took the wind out of my sails lol great video tho. I'm sure I'll use this information... Somehow.
@azeemmohammed7533
@azeemmohammed7533 3 ай бұрын
Not really… build showcase it as flaw in the system to the hr
@x2niosofficial20
@x2niosofficial20 5 ай бұрын
Greate
@mishkathossain2984
@mishkathossain2984 4 ай бұрын
Hey this is paid stuff right?? Bright data is paid. I can't do it do it for free.
@TechWithTim
@TechWithTim 4 ай бұрын
No the web driver and everything else is free
@kivala1695
@kivala1695 7 күн бұрын
if you run into COOKIE pop up issue that has to be accepted watch the video from 18:14
@neozon
@neozon Ай бұрын
coockie by muscle memory? 😏
@vijayjadav1808
@vijayjadav1808 5 ай бұрын
@ 25:10
@HBaker40
@HBaker40 5 ай бұрын
I keep getting the 'before you continue' pop up. It prevents the script from adding the keys into the search bar. Does anyone know how to resolve this?
@DttDat
@DttDat 2 ай бұрын
Chromedriver is not necessary
@degerdi
@degerdi 5 ай бұрын
i get paid a lot of money doing this
@robberttruijens6552
@robberttruijens6552 5 ай бұрын
Please do tell me more😊 What exactly are you automating and how did you get into doing that? Honestly very curious to hear your answer, I hope you will take the time to answer 🙏
@degerdi
@degerdi 5 ай бұрын
@@robberttruijens6552 right now I automate web application tests for a large organization using selenium, stuff like salesforce. I started as help desk in the military creating accounts, changing passwords, so I learned how to do everything manually first. Became a system engineer, a cyber security engineer, an infrastructure architect, devops engineer, then a SDET. Now I’m just an SDE that kinda focuses on tests. I get hired on name recognition now.
@emperor8716
@emperor8716 3 ай бұрын
3:20
How To Actually Make $10k A Month Coding
14:54
Tech With Tim
Рет қаралды 58 М.
PLEASE Use These 5 Python Decorators
20:12
Tech With Tim
Рет қаралды 84 М.
Can You Draw The PERFECT Circle?
00:57
Stokes Twins
Рет қаралды 60 МЛН
Glow Stick Secret 😱 #shorts
00:37
Mr DegrEE
Рет қаралды 123 МЛН
Web Scraping 101: A Million Dollar Project Idea
13:07
Tech With Tim
Рет қаралды 525 М.
Python Web Scraping Example: Selenium and Beautiful Soup
7:44
Python ML Daily
Рет қаралды 1,2 М.
Web Scraping Made EASY With Power Automate Desktop - For FREE & ZERO Coding
13:11
Python Advanced AI Agent Tutorial - LlamaIndex, Ollama and Multi-LLM!
53:57
5 Coding Projects That Give You An UNFAIR Advantage
9:40
Tech With Tim
Рет қаралды 161 М.
INSANE OpenAI News: GPT-4o and your own AI partner
28:48
AI Search
Рет қаралды 348 М.
3 Python Projects I’d Put On MY Resume
14:49
Tech With Tim
Рет қаралды 23 М.
5 Mini Python Projects - For Beginners
1:41:08
Tech With Tim
Рет қаралды 2,7 МЛН
Can You Draw The PERFECT Circle?
00:57
Stokes Twins
Рет қаралды 60 МЛН