Python Selenium Tutorial #1 - Web Scraping, Bots & Testing

Python Selenium Tutorial #1 - Web Scraping, Bots & Testing

Tech With Tim

4 года назад

1,539,205 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@williamli1047
@williamli1047 - 19.11.2023 08:36

For those who watch this video years after it posted. I think a few things are changed:
1) you do not need to download the web driver anymore. Just use
driver = webdriver.Chrome()
2) if you open a page and it closes immediately, add the following (assuming you are using Chrome as well):
from selenium.webdriver.chrome.options import Options
options = Options()
options.add_experimental_option("detach", True)
driver = webdriver.Chrome(options= options)
These are two main issues I had when I was coding along. Took me sometime to figure out a solution. Hope it helps.

Ответить
@icarus4716
@icarus4716 - 01.12.2023 18:10

Noupeis, vs code supremacy

Ответить
@patrickstar8585
@patrickstar8585 - 03.12.2023 22:03

Is this still valid with Chrome version 119.0.6045.199? I checked the status and it was x? ..

Ответить
@dafdukkabmadiun6304
@dafdukkabmadiun6304 - 04.12.2023 07:48

love this. great chanel. subscribed

Ответить
@bunkersurf2779
@bunkersurf2779 - 08.12.2023 06:13

I am sorry but this course is very old and very painfull to follow

Ответить
@NoToBusinessCasual
@NoToBusinessCasual - 11.12.2023 04:17

Seems like I am too late to the party. Chrome version has advanced far ahead (119.xxxxxxxx) and the mentioned chrome driver webpage does not exist any longer. Perhaps that leads to a call to look for a more recent tutorial on Selenium.

Ответить
@lameshithead
@lameshithead - 21.12.2023 13:55

you can even have multiple selenium sessions with a virtual moon browser in you kubernetes cluster. i just wrote a script that gets cryptodata from dynamic webpages as a csv. then i asked my self how i could implement it directly in my cluster and even thats possible its so frkn crazy. but you can only have up to 4 parallel sessions in free mode though. i wonder how y<ou could use it to scrape data via a some sort of web aware llm to get nice tables from random webpages.

Ответить
@aebel.shajan
@aebel.shajan - 22.12.2023 20:49

wow this is very concise and clear. you have great communication skills :D

Ответить
@MrJcc444
@MrJcc444 - 29.12.2023 22:33

this has some potential but no matter what I tried it doesn't work , tried it on the mac .windows same issue 'str' has no capabilities and nowhere to go from there

Ответить
@madama0P919
@madama0P919 - 02.01.2024 11:46

My chrome version is Version 120.0.6099.130 (Official Build) (64-bit) and I cant find a webdriver for chrome

Ответить
@ME-MARCOS
@ME-MARCOS - 03.01.2024 14:44

wtf is that

Ответить
@callme_xoroz
@callme_xoroz - 03.01.2024 15:02

msg = f"Unable to obtain driver for {options.capabilities['browserName']} using Selenium Manager."
^^^^^^^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'capabilities'

Ответить
@VladimirUgljesin
@VladimirUgljesin - 22.01.2024 22:06

How can I solve a problem of window immediately closing after starting "run" (I am using chrome and VScode)

Ответить
@dmytro_dexter
@dmytro_dexter - 04.02.2024 00:09

Once my browser opens it immediately closes, how can I do it the way you show in the video? I have used the same code and the same parameters, but my browser can stay on the screen if I use a delay function.

Ответить
@alpixfere
@alpixfere - 06.02.2024 09:40

right after i finished the course, i wrote a programm that will spam join a kahoot game that crashes game whenever teacher gives out the code, and i'll let my programm pick some inappropreate name, anyway love your courses

Ответить
@cheezmartian
@cheezmartian - 15.02.2024 18:49

This is now outdated and cannot be used

Ответить
@Rucha599
@Rucha599 - 19.02.2024 10:30

A webpage I am trying to load has around 270 tr tags, but it's only returning 102.What could be the problem?

Ответить
@marcosalazar6075
@marcosalazar6075 - 21.02.2024 23:16

how do i can fix this problem? :
msg = f"Unable to obtain driver for {options.capabilities['browserName']} using Selenium Manager."
AttributeError: 'str' object has no attribute 'capabilities'

Ответить
@EMRAutumn
@EMRAutumn - 22.02.2024 12:42

Will it work with safari?

Ответить
@akremgomri9085
@akremgomri9085 - 14.03.2024 01:07

I enjoyed the video so much, but there is an update for newer versions of chrome.
You shoould do this :
from selenium import webdriver

PATH = "C:\\Program Files\\chromedriver-win64\\chromedriver.exe"
cService = webdriver.ChromeService(executable_path=PATH)
driver = webdriver.Chrome(service = cService)

Instead of passing the executable_path to Chrome() directly.

Ответить
@levon9
@levon9 - 23.03.2024 17:03

Great intro, about to jump to your 2nd video but here are some updated instructions since the PATH part doesn't work as shown:

from selenium import webdriver

driver = webdriver.Chrome()
driver.get("theURL")
driver.quit()

Ответить
@СеменХеруимов
@СеменХеруимов - 29.03.2024 22:36

Тим крутой

Ответить
@MidasRah
@MidasRah - 08.05.2024 06:39

I couldn’t even get this shit to take 1,000 screenshots 🥲

Ответить
@vazp3
@vazp3 - 09.05.2024 21:31

May 2024: Following the instructions and using
"
from selenium import webdriver
service = webdriver.ChromeService(executable_path = 'C:\Program Files (x86)\chromedriver.exe')
driver = webdriver.Chrome(service=service)
"
worked for me, otherwise an error appears: " 'str' object has no attribute 'capabilities' "

Ответить
@דניאלאביב-ו6ת
@דניאלאביב-ו6ת - 13.05.2024 00:32

Link to chrome web-driver is no longer working

Ответить
@JuanPerez-cs1gx
@JuanPerez-cs1gx - 27.05.2024 18:53

Thanks for explaining pip. I think people doing tutorials or guides for whichever language or framework are kind of allergic to explaining package managers and assume that everyone knows what they are talking about.

Ответить
@zeffy._440
@zeffy._440 - 04.06.2024 18:33

Alright so it appears that the code in this tutorial does not work.

this is what I put in the application called "sublime text" which just lets you write the code and execute it (ctrl+) for execution (ctrl+pause/break button) to end and close the code

from selenium import webdriver

driver = webdriver.Chrome()

driver.get("put your chosen website here")

input()


I found this on the Selenium website you can replace the website with whatever website you are going for. This video is not very good at explaining most things i.e. how to execute or end code or much to begin with especially since the link does not work to begin with.

'str' object has no attribute 'capabilities is a common error I came across

Ответить
@motormusic1
@motormusic1 - 12.06.2024 17:14

This is a confusing tutorial for a beginner.. First, I don't know what the command window is that you're using where you typed 'import selenium'. Because of this, I don't know what to do once i've completed the installation of Selenium (which shows when i type 'pip list' in cmd). I'm now totally lost.. help :/

Ответить
@robydivincenzo821
@robydivincenzo821 - 18.06.2024 16:19

Tks ! Voici un post à venir qui pourraient intéresser plusieurs abonnés et autres, c'est le fait de pouvoir trouver comment cliquer sur les choix de demandes de consentements comme sur le site Mappy, qui contient une masse d'infos de Pros et surtout leur email..., mais il y a des fenêtres qui sont bloquantes et difficiles à contourner ("Accepter &amp; Fermer" + "Continuer sans accepter" + "Connexion" ...), merci pour ton écoute? Roby

Ответить
@MalikFaragalla
@MalikFaragalla - 19.06.2024 19:43

thanks for the videos

Ответить
@BBRR442
@BBRR442 - 07.07.2024 05:30

Wow this feels really outdated now..

Ответить
@hojaelee71
@hojaelee71 - 11.07.2024 05:57

Not working.
from selenium import webdriver
PATH = "C:\Program Files (x86)\chromedriver.exe"
driver = webdriver.Chrome(PATH)
AttributeError: 'str' object has no attribute 'capabilities'

Ответить
@navyanarayan8655
@navyanarayan8655 - 20.07.2024 06:37

the version of chrome i installed doesnt have a chrome driver of the same version. i am unable to figure out how to download an older version as well...

Ответить
@avisrivastava4140
@avisrivastava4140 - 01.08.2024 21:05

the link wont work lol

Ответить
@girifirmansyah.2761
@girifirmansyah.2761 - 08.08.2024 17:39

bro i get error "Timeout value connect was <object object at 0x0000023DEB2E46E0>, but it must be an int, float or None.", anyone solve this?

Ответить
@cappy6604
@cappy6604 - 12.08.2024 17:14

if you encounter an error that says something like 'str object has no capabilities' try this

cService = webdriver.ChromeService(executable_path='where you stored the exe')

driver = webdriver.Chrome(service = cService)

i'm not an expert but this fixed it for me

Ответить
@JamesQ2011
@JamesQ2011 - 22.08.2024 11:03

Can anyone link the latest chrome web driver please?

Ответить
@0Sareena0
@0Sareena0 - 02.09.2024 20:37

Better than a Udemy course. What a king you are

Ответить
@DanielCioanca
@DanielCioanca - 06.09.2024 20:20

It suddenly closes for me after installing it. Don't understand why. (Mind you I'm coming from the future, so the Python and Selenium and Chrome versions are higher)

Ответить
@aniketshinde4416
@aniketshinde4416 - 10.09.2024 14:01

So concise and to the point. Makes it look easy.

Ответить
@djohnworthy1040
@djohnworthy1040 - 10.09.2024 21:21

Scraping is nice, but you get detected by Bot Detectors. How to avoid them?

Ответить
@Moyskieeee
@Moyskieeee - 19.09.2024 10:30

how do we proceed if the link on the chromedriver isn't working? any workaround please

Ответить
@Forsythia1330
@Forsythia1330 - 27.09.2024 04:56

what is the selenium ide that you use sir?

Ответить
@sapemi08
@sapemi08 - 08.10.2024 00:22

I am an old guy, but I enjoy learning with your videos. As the time passes by I see you growing from an intelligent, agile teen to a more seasoned young man. Cheers!

Ответить
@donglinjin4765
@donglinjin4765 - 20.10.2024 21:11

I just started learning Selenium and the first problem I encountered was that selenium will automatically close the window if no action is made. So basically if you run the code in this video the window will stay opened for like 2 seconds then it will be shutdown. However I found a solution, add "while True: pass" in the end of the script. I hope it helps!

Ответить
@ZbigniewLoboda
@ZbigniewLoboda - 05.11.2024 19:12


I love it. Unlike other tutorial authors, this one was well-prepared for the presentation.

Ответить
@rgblidarproject
@rgblidarproject - 17.11.2024 23:02

Did any of you guys in the comments changed your life because of this video ( for four years ago)

Ответить
@marjotoska
@marjotoska - 21.11.2024 18:31

Heads up, in 2024, doing: "driver = webdriver.Chrome(PATH)" will throw an error.
It can be fixed by removing PATH, like this: "driver = webdriver.Chrome()"

Ответить