Тёмный

Python Selenium Tutorial - Automate Websites and Create Bots 

Tech With Tim
Подписаться 1,5 млн
Просмотров 143 тыс.
50% 1

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

Опубликовано:

 

2 июн 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 156   
@thembekilethembekile5839
@thembekilethembekile5839 3 месяца назад
It’s been years now and you still manage to release content when I need it the most. You just clutch dude ❤
@HebbenBeeld
@HebbenBeeld 6 месяцев назад
@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 6 месяцев назад
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 4 месяца назад
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 3 месяца назад
Have you found more videos about the slenium?
@luisfcocontreras
@luisfcocontreras 6 месяцев назад
You should do an updated selenium series 🔥 would love that, some automation testing for things like SDET or QA
@luisemilioogando
@luisemilioogando 6 месяцев назад
Great one, this is what i'm looking for, Automation, web scraping, bots, pytho automation, Qa automation.. Thank you so much. You are amazing.
@Ohiostategenerationx
@Ohiostategenerationx 2 месяца назад
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.
@artabra1019
@artabra1019 5 месяцев назад
Thanks for your selenium tutorials I have made 20k$ earnings as freelancer web scraping in Upwork.
@MaxTheFireCat
@MaxTheFireCat 6 месяцев назад
I feel nostalgic, I remember watching your selenium series a few years ago
@alexurrutia6495
@alexurrutia6495 5 месяцев назад
Your tutorials are clutch man, thank you for all the knowledge!
@EzraKoenigsberg-hn9pk
@EzraKoenigsberg-hn9pk 19 дней назад
Great video! Been looking for something that explains this process for a while.
@phaedrus2633
@phaedrus2633 6 месяцев назад
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!
@garrettsmith315
@garrettsmith315 6 месяцев назад
This is excellent, love everything about this!
@itstechshow7747
@itstechshow7747 6 месяцев назад
You are a genius 🔥 Your effort is remarkable ❤
@bennikllr5509
@bennikllr5509 6 месяцев назад
thanks, wanted to do this yesterday and kinda messed it up. (the old videos to selenium and the new driver) now everything works fine
@sixthsense844
@sixthsense844 6 месяцев назад
More selenium tutorial please, keep up the great content
@AsuGhimire
@AsuGhimire 6 месяцев назад
DUDE I NEEDED THIS AND YOU JUS UPLOADED IT XD
@carlitosvh91
@carlitosvh91 6 месяцев назад
This was very helpful. Thank you very much.
@georgekamakia7591
@georgekamakia7591 6 месяцев назад
great!!, thanks for the tutorial just what i needed
@fernandomartino4708
@fernandomartino4708 6 месяцев назад
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?
@parsakei9006
@parsakei9006 Месяц назад
Great tutorial sir, thank you.
@vascomarques2380
@vascomarques2380 5 месяцев назад
LETS GO, UPDATED VIDEOOO
@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?
@doug8487
@doug8487 3 месяца назад
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!
@samurai317
@samurai317 6 месяцев назад
Thank you so much for this.
@jabirmustafasulaiman5147
@jabirmustafasulaiman5147 6 месяцев назад
Wonderful project❤
@MrIncredible-mu5ec
@MrIncredible-mu5ec 6 месяцев назад
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 6 месяцев назад
Create an API for your selenium script and host it on a linode instance. There are tutorials for both.
@moumnalmunawy1806
@moumnalmunawy1806 6 месяцев назад
So what do you use?
@gustavojuantorena
@gustavojuantorena 6 месяцев назад
You can use a docker container. There is containers with selenium already installed.
@brentfiegle9761
@brentfiegle9761 6 месяцев назад
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
@fatimanoor2497
@fatimanoor2497 6 месяцев назад
Thanks Tim bro😊😊😊
@repairstudio4940
@repairstudio4940 6 месяцев назад
Selenium = fun with Tim 🎉
@user-ps2zr5lh8q
@user-ps2zr5lh8q 3 месяца назад
Is no one else getting ElementNotInteractableException: Message: element not interactable?
@akrammohamed8374
@akrammohamed8374 День назад
I LOVE YOU TECH WITH TIM
@shawntiaw
@shawntiaw 3 месяца назад
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?
@richardsifeanyi6766
@richardsifeanyi6766 6 месяцев назад
Thanks for sharing 🙏
@VoidTailor
@VoidTailor 6 месяцев назад
great content!
@user-wu4ip7mp3z
@user-wu4ip7mp3z Месяц назад
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?
@rverm1000
@rverm1000 6 месяцев назад
wow thats so cool. i can use that.
@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.
@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.
@bisyrim1030
@bisyrim1030 6 месяцев назад
also you can use driver.implicity_wait(10) instead of time.sleep(10)
@nurdinmoha3505
@nurdinmoha3505 6 месяцев назад
You are the BEST
@cristianionut9885
@cristianionut9885 5 месяцев назад
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?
@MelTrades
@MelTrades 6 месяцев назад
Hey Tim how do i fix it if chrome driver is 120.0.6099.62 but mine is 120.0.6099.63
@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 4 месяца назад
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 2 месяца назад
I tried the full path and it works.
@jm27925
@jm27925 26 дней назад
@@hakouthegamer7978 thanks for this. this resolved the issue for me in seconds.
@dogukantaytuglu
@dogukantaytuglu 9 дней назад
@@yangsong6111 thanks!
@oluwatosinoseni5413
@oluwatosinoseni5413 6 месяцев назад
Does selenium still need us to install the drivers, i thought its now installed with the selenium 4.10
@guptaswork1695
@guptaswork1695 6 месяцев назад
TQ for the wonderful content ❤❤❤❤
@TechWithTim
@TechWithTim 6 месяцев назад
It's my pleasure
@guptaswork1695
@guptaswork1695 6 месяцев назад
​@@TechWithTimlearning lot from you ❤😊
@user-gl9ul5is6o
@user-gl9ul5is6o 2 месяца назад
i love this guys
@rudyruderabbit
@rudyruderabbit 2 месяца назад
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
@REALANSHUMAN
@REALANSHUMAN Месяц назад
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
@jaschyns
@jaschyns 2 месяца назад
I dont know where my selenium folder is man, i installed it through Pycharm.. dont know the default location.
@hongzhisui
@hongzhisui 4 месяца назад
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 3 месяца назад
Did you put chromedriver.exe in the same folder as your .py file?
@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.
@MdRihab-ob5zk
@MdRihab-ob5zk 2 месяца назад
Thanks Brother
@py_world
@py_world 2 месяца назад
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)
@jakemcardle1936
@jakemcardle1936 Месяц назад
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?
@ZoonCodes-er1rb
@ZoonCodes-er1rb 5 месяцев назад
Thank you.
@memeshouse8621
@memeshouse8621 3 месяца назад
when try to login into gmail it says "could nkt sing in , browser not secure" how to solved it?
@esat0_090
@esat0_090 6 месяцев назад
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
@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
@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
@PhunkyBob
@PhunkyBob 6 месяцев назад
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 6 месяцев назад
Not sure if you add a lot of logs or code RU-vid might think you’re a bot
@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?
@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 4 месяца назад
still having issues with this?
@ima6683
@ima6683 4 месяца назад
I came to look for copper and I found gold. thanks for the video. you saved me. I hate pychar. I love vsc.
@AmirRTR
@AmirRTR 3 месяца назад
Big video ❤
@makobobinzers
@makobobinzers 24 дня назад
is there a free alternative to brightdata?
@Agnarr_Valhalla
@Agnarr_Valhalla 3 месяца назад
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
@chetanpatil2473
@chetanpatil2473 4 месяца назад
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
@yassinehsouna5425
@yassinehsouna5425 3 месяца назад
i cant find the same version of the webdriver
@user-ts5ku2il8b
@user-ts5ku2il8b 17 дней назад
thanks bro
@alexicek011
@alexicek011 6 месяцев назад
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 6 месяцев назад
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.
@johnmantzanis1213
@johnmantzanis1213 Месяц назад
what if the ID and class names are changing every time you log in to the website?
@oblivion7300
@oblivion7300 4 месяца назад
can someone tell me where he got the class gLFyf because i didnt see it
@sajidghanchi7591
@sajidghanchi7591 28 дней назад
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?
@SinghAvtar121
@SinghAvtar121 6 месяцев назад
Which vs code theme do u use?
@TechWithTim
@TechWithTim 6 месяцев назад
Monokai
@mahapeyuw5946
@mahapeyuw5946 3 месяца назад
service=service didn't run. It gave me a traceback error.
@kayoutube690
@kayoutube690 8 дней назад
Is this working if the app is saml integrated??
@QuyenNguyen-xq5wt
@QuyenNguyen-xq5wt Месяц назад
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?
@AaronRMG
@AaronRMG 6 месяцев назад
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 6 месяцев назад
The terminal points at this line: driver = webdriver.Chrome(service=service)
@AaronRMG
@AaronRMG 6 месяцев назад
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?
@weistrass
@weistrass 2 дня назад
Can it run on background?
@Rahul_Singh_Rajput_04
@Rahul_Singh_Rajput_04 4 месяца назад
Thank you For saving my time
@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
@goldcandles
@goldcandles 21 день назад
Can i make option with bot doing order according to telegram channel
@shreyaschavan7976
@shreyaschavan7976 6 месяцев назад
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
@ElParacletoPodcast
@ElParacletoPodcast 4 месяца назад
Thanks, but my Mac mini won;t let me run that file!
@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?
@noobCoder7
@noobCoder7 3 месяца назад
how to handle if div is used as textfield
@ernestocalzadilla8632
@ernestocalzadilla8632 2 месяца назад
@02:40 Here the executable_path has been deprecated already. 👍
@karlybyrd1551
@karlybyrd1551 4 месяца назад
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 4 месяца назад
Not really… build showcase it as flaw in the system to the hr
@thegodstudent
@thegodstudent 6 месяцев назад
Cool
@bordignonjunior
@bordignonjunior 6 месяцев назад
AttributeError: 'WebDriver' object has no attribute 'get_element' why?
@eyebol
@eyebol 6 месяцев назад
watch 5 more seconds in
@pubgillusiontown5959
@pubgillusiontown5959 6 месяцев назад
May be find elements work
@x2niosofficial20
@x2niosofficial20 5 месяцев назад
Greate
@DECODEDN
@DECODEDN 22 дня назад
It tells me elementnotinteractable
@Kiraa478
@Kiraa478 5 дней назад
Can i do this for automate an telegram bot? Please if somebody can fast reply me. Thanks.
@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 25 дней назад
if you run into COOKIE pop up issue that has to be accepted watch the video from 18:14
@neozon
@neozon 2 месяца назад
coockie by muscle memory? 😏
@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?
@vijayjadav1808
@vijayjadav1808 6 месяцев назад
@ 25:10