Python Selenium Tutorial - Automate Websites and Create Bots

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

Пікірлер: 168

  • @thembekilethembekile5839
    @thembekilethembekile58394 ай бұрын

    It’s been years now and you still manage to release content when I need it the most. You just clutch dude ❤

  • @HebbenBeeld
    @HebbenBeeld7 ай бұрын

    @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
    @dfsed10577 ай бұрын

    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
    @adesinapsalmlord73056 ай бұрын

    I really love Tim tutorial for it conciseness and Simplicity Thanks for always serving us the best

  • @spazztik
    @spazztik4 ай бұрын

    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

    4 ай бұрын

    Bro what you trying automate?

  • @AshokanandChaudhary786

    @AshokanandChaudhary786

    4 ай бұрын

    Have you found more videos about the slenium?

  • @cbacca2999

    @cbacca2999

    24 күн бұрын

    When I search YT or Google I always set my search to find stuff in the last year only.

  • @luisfcocontreras
    @luisfcocontreras7 ай бұрын

    You should do an updated selenium series 🔥 would love that, some automation testing for things like SDET or QA

  • @MaxTheFireCat
    @MaxTheFireCat7 ай бұрын

    I feel nostalgic, I remember watching your selenium series a few years ago

  • @luisemilioogando
    @luisemilioogando7 ай бұрын

    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
    @alexurrutia64955 ай бұрын

    Your tutorials are clutch man, thank you for all the knowledge!

  • @EzraKoenigsberg-hn9pk
    @EzraKoenigsberg-hn9pkАй бұрын

    Great video! Been looking for something that explains this process for a while.

  • @Ohiostategenerationx
    @Ohiostategenerationx3 ай бұрын

    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.

  • @phaedrus2633
    @phaedrus26337 ай бұрын

    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
    @garrettsmith3157 ай бұрын

    This is excellent, love everything about this!

  • @vascomarques2380
    @vascomarques23806 ай бұрын

    LETS GO, UPDATED VIDEOOO

  • @AsuGhimire
    @AsuGhimire7 ай бұрын

    DUDE I NEEDED THIS AND YOU JUS UPLOADED IT XD

  • @bennikllr5509
    @bennikllr55097 ай бұрын

    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
    @sixthsense8447 ай бұрын

    More selenium tutorial please, keep up the great content

  • @itstechshow7747
    @itstechshow77477 ай бұрын

    You are a genius 🔥 Your effort is remarkable ❤

  • @BikerBoyz7
    @BikerBoyz73 күн бұрын

    Nicely explained thanks Tim

  • @georgekamakia7591
    @georgekamakia75917 ай бұрын

    great!!, thanks for the tutorial just what i needed

  • @carlitosvh91
    @carlitosvh917 ай бұрын

    This was very helpful. Thank you very much.

  • @seomaster7171
    @seomaster717125 күн бұрын

    Спасибо за подробный разбор, новая связка на отлично. Два круга, все сработало!

  • @fernandomartino4708
    @fernandomartino47087 ай бұрын

    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?

  • @artabra1019
    @artabra10196 ай бұрын

    Thanks for your selenium tutorials I have made 20k$ earnings as freelancer web scraping in Upwork.

  • @Chettahsofiane

    @Chettahsofiane

    9 күн бұрын

    علمني معك اريد ان اربح معك 20 الف دولار اخي

  • @ColeHillyer
    @ColeHillyer18 күн бұрын

    Excellent lesson thanks for explaining each step

  • @alexurrutia6495
    @alexurrutia64955 ай бұрын

    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?

  • @parsakei9006
    @parsakei90062 ай бұрын

    Great tutorial sir, thank you.

  • @samurai317
    @samurai3177 ай бұрын

    Thank you so much for this.

  • @MrIncredible-mu5ec
    @MrIncredible-mu5ec7 ай бұрын

    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

    7 ай бұрын

    Create an API for your selenium script and host it on a linode instance. There are tutorials for both.

  • @moumnalmunawy1806

    @moumnalmunawy1806

    7 ай бұрын

    So what do you use?

  • @gustavojuantorena

    @gustavojuantorena

    7 ай бұрын

    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

    6 ай бұрын

    Using a Linux server is doable but much more complex

  • @fatimanoor2497
    @fatimanoor24977 ай бұрын

    Thanks Tim bro😊😊😊

  • @richardsifeanyi6766
    @richardsifeanyi67667 ай бұрын

    Thanks for sharing 🙏

  • @user-ps2zr5lh8q
    @user-ps2zr5lh8q4 ай бұрын

    Is no one else getting ElementNotInteractableException: Message: element not interactable?

  • @repairstudio4940
    @repairstudio49407 ай бұрын

    Selenium = fun with Tim 🎉

  • @bisyrim1030
    @bisyrim10306 ай бұрын

    also you can use driver.implicity_wait(10) instead of time.sleep(10)

  • @jabirmustafasulaiman5147
    @jabirmustafasulaiman51477 ай бұрын

    Wonderful project❤

  • @akrammohamed8374
    @akrammohamed837427 күн бұрын

    I LOVE YOU TECH WITH TIM

  • @doug8487
    @doug84874 ай бұрын

    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

    3 ай бұрын

    that worked for me!

  • @rverm1000
    @rverm10007 ай бұрын

    wow thats so cool. i can use that.

  • @shawntiaw
    @shawntiaw4 ай бұрын

    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?

  • @jocois
    @jocois4 ай бұрын

    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.

  • @ZoonCodes-er1rb
    @ZoonCodes-er1rb6 ай бұрын

    Thank you.

  • @nurdinmoha3505
    @nurdinmoha35057 ай бұрын

    You are the BEST

  • @MdRihab-ob5zk
    @MdRihab-ob5zk3 ай бұрын

    Thanks Brother

  • @VoidTailor
    @VoidTailor7 ай бұрын

    great content!

  • @makobobinzers
    @makobobinzersАй бұрын

    is there a free alternative to brightdata?

  • @rajagam5325
    @rajagam532512 күн бұрын

    thank you

  • @RohxnYadav
    @RohxnYadav3 ай бұрын

    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.

  • @MohammedSalah2405
    @MohammedSalah240520 күн бұрын

    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

    11 күн бұрын

    I'm sure they are not real people

  • @user-gl9ul5is6o
    @user-gl9ul5is6o3 ай бұрын

    i love this guys

  • @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?

  • @py_world
    @py_world3 ай бұрын

    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)

  • @justgoto8
    @justgoto83 ай бұрын

    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

  • @MelTrades
    @MelTrades6 ай бұрын

    Hey Tim how do i fix it if chrome driver is 120.0.6099.62 but mine is 120.0.6099.63

  • @yassinehsouna5425
    @yassinehsouna54254 ай бұрын

    i cant find the same version of the webdriver

  • @benasmaciulaitis3292
    @benasmaciulaitis329217 күн бұрын

    Somewhy, when I run the ''python main.py'' command in terminal, I don't get anything, chrome doesn't start, nothing happens, at all.

  • @oblivion7300
    @oblivion73005 ай бұрын

    can someone tell me where he got the class gLFyf because i didnt see it

  • @user-ts5ku2il8b
    @user-ts5ku2il8bАй бұрын

    thanks bro

  • @oluwatosinoseni5413
    @oluwatosinoseni54137 ай бұрын

    Does selenium still need us to install the drivers, i thought its now installed with the selenium 4.10

  • @rudyruderabbit
    @rudyruderabbit3 ай бұрын

    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

  • @cristianionut9885
    @cristianionut98856 ай бұрын

    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?

  • @hongzhisui
    @hongzhisui5 ай бұрын

    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

    4 ай бұрын

    Did you put chromedriver.exe in the same folder as your .py file?

  • @memeshouse8621
    @memeshouse86214 ай бұрын

    when try to login into gmail it says "could nkt sing in , browser not secure" how to solved it?

  • @PhunkyBob
    @PhunkyBob7 ай бұрын

    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

    7 ай бұрын

    Not sure if you add a lot of logs or code KZread might think you’re a bot

  • @noobCoder7
    @noobCoder74 ай бұрын

    how to handle if div is used as textfield

  • @johnmantzanis1213
    @johnmantzanis12132 ай бұрын

    what if the ID and class names are changing every time you log in to the website?

  • @REALANSHUMAN
    @REALANSHUMAN2 ай бұрын

    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

  • @jdoublea2023
    @jdoublea20232 ай бұрын

    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_0907 ай бұрын

    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

    6 ай бұрын

    Monokai syntax theme

  • @chetanpatil2473
    @chetanpatil24735 ай бұрын

    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

  • @Dominichii7
    @Dominichii718 күн бұрын

    Do I have to update the chrome driver every time Google updates actual Chrome?

  • @AmirRTR
    @AmirRTR4 ай бұрын

    Big video ❤

  • @FlockofSmeagles
    @FlockofSmeagles3 ай бұрын

    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.

  • @top3model
    @top3model5 ай бұрын

    hi Im getting this error when trying to install chrome driver, Google-Edge-Cache: forbidden Error: 7 please help me with it

  • @jaschyns
    @jaschyns3 ай бұрын

    I dont know where my selenium folder is man, i installed it through Pycharm.. dont know the default location.

  • @jakemcardle1936
    @jakemcardle19362 ай бұрын

    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?

  • @ima6683
    @ima66835 ай бұрын

    I came to look for copper and I found gold. thanks for the video. you saved me. I hate pychar. I love vsc.

  • @RIFADOR001
    @RIFADOR0016 ай бұрын

    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

    5 ай бұрын

    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

    3 ай бұрын

    I tried the full path and it works.

  • @jm27925

    @jm27925

    Ай бұрын

    @@hakouthegamer7978 thanks for this. this resolved the issue for me in seconds.

  • @dogukantaytuglu

    @dogukantaytuglu

    Ай бұрын

    @@yangsong6111 thanks!

  • @AmitojGamerBoy
    @AmitojGamerBoy7 ай бұрын

    Which vs code theme do u use?

  • @TechWithTim

    @TechWithTim

    7 ай бұрын

    Monokai

  • @moisespereire9528
    @moisespereire95286 ай бұрын

    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

    5 ай бұрын

    It's standard, you can check your python interpreter (down right)

  • @moisespereire9528

    @moisespereire9528

    5 ай бұрын

    ​ 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?

  • @mahapeyuw5946
    @mahapeyuw59464 ай бұрын

    service=service didn't run. It gave me a traceback error.

  • @joshuawiley6506
    @joshuawiley65066 ай бұрын

    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

    5 ай бұрын

    still having issues with this?

  • @Agnarr_Valhalla
    @Agnarr_Valhalla4 ай бұрын

    What do i do if chroome cookies consent block me from doing anything ?

  • @Agnarr_Valhalla

    @Agnarr_Valhalla

    3 ай бұрын

    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

  • @ElParacletoPodcast
    @ElParacletoPodcast5 ай бұрын

    Thanks, but my Mac mini won;t let me run that file!

  • @weistrass
    @weistrass27 күн бұрын

    Can it run on background?

  • @shreyaschavan7976
    @shreyaschavan79766 ай бұрын

    can't we just use 'from selenium import * '?

  • @Rahul_Singh_Rajput_04
    @Rahul_Singh_Rajput_045 ай бұрын

    Thank you For saving my time

  • @mubeenahmed5622
    @mubeenahmed56222 күн бұрын

    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???

  • @sajidghanchi7591
    @sajidghanchi7591Ай бұрын

    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?

  • @kayoutube690
    @kayoutube690Ай бұрын

    Is this working if the app is saml integrated??

  • @nguyeninhan8542
    @nguyeninhan8542Күн бұрын

    Nice

  • @alexicek011
    @alexicek0117 ай бұрын

    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

    7 ай бұрын

    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.

  • @FatihMumtaz-tt5to
    @FatihMumtaz-tt5toКүн бұрын

    if i have do it and nothing changes , what's wrong??? its not opened the chrome.....

  • @thegodstudent
    @thegodstudent7 ай бұрын

    Cool

  • @ernestocalzadilla8632
    @ernestocalzadilla86323 ай бұрын

    @02:40 Here the executable_path has been deprecated already. 👍

  • @AaronRMG
    @AaronRMG7 ай бұрын

    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

    7 ай бұрын

    The terminal points at this line: driver = webdriver.Chrome(service=service)

  • @AaronRMG

    @AaronRMG

    7 ай бұрын

    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?

  • @goldcandles
    @goldcandlesАй бұрын

    Can i make option with bot doing order according to telegram channel

  • @tilltheend6634
    @tilltheend66346 ай бұрын

    how to disable the pop up page asking to refuse or accept the chart please

  • @tilltheend6634

    @tilltheend6634

    6 ай бұрын

    great video btw

  • @marcmuehleisen

    @marcmuehleisen

    6 ай бұрын

    @@tilltheend6634 weird that tim still did not answer this as lots of ppl had this question already

  • @tilltheend6634

    @tilltheend6634

    6 ай бұрын

    @@marcmuehleisen i had the solution once with chatgpt

  • @marcmuehleisen

    @marcmuehleisen

    6 ай бұрын

    What did you ask?

  • @samson6707
    @samson67074 ай бұрын

    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

  • @x2niosofficial20
    @x2niosofficial206 ай бұрын

    Greate

  • @bordignonjunior
    @bordignonjunior7 ай бұрын

    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

Келесі