Login and Scrape Data with Playwright and Python

Ғылым және технология

Selenium no more.. Playwright is an easy to use, powerful, convenient and modern approach to browser automation. It works very well with Python giving us access to control our browser with code.
In this short mini series I am going to demo some of my favourite Playwright features starting with this video, logging into a demo dashboard to pull out a simple piece of data.
DISCORD (NEW): / discord
Scraper API: www.scrapingbee.com/?fpr=jhnwr
Proxies I use proxyscrape.com/?ref=jhnwr
Patreon: / johnwatsonrooney (NEW)
Amazon UK: amzn.to/2OYuMwo
Hosting: Digital Ocean: m.do.co/c/c7c90f161ff6
Gear Used: jhnwr.com/gear/ (NEW)
-------------------------------------
Disclaimer: These are affiliate links and as an Amazon Associate I earn from qualifying purchases
-------------------------------------

Пікірлер: 174

  • @AsfandSaleem
    @AsfandSaleem Жыл бұрын

    This is the first time I got introduced to Playwright, so much more elegant than Selenium. Thanks for sharing!

  • @wanderingfool7136
    @wanderingfool71362 жыл бұрын

    You have the absolute best videos on KZread!!! I'm resisting the urge to type in all caps right now lol but seriously, this video just helped me finish a $200 project!! Thanks again for all you do for the community 🙏🙏🙏

  • @stevefox7469
    @stevefox74692 жыл бұрын

    Great stuff, as usual. I am using stuff I learn from your channel almost everyday.

  • @Zale370
    @Zale3702 жыл бұрын

    Great video John, as usual! I started using playwirght a few months ago and prefer it to selenium or helium, it is much faster, way less error prone and it is being updated constantly.

  • @JohnWatsonRooney

    @JohnWatsonRooney

    2 жыл бұрын

    Yes totally agree

  • @dimaua1830
    @dimaua18302 жыл бұрын

    Hi John. Just wanted to say thank you and please keep making these videos. I have been studying Data Analytics online and just got a job offer for analytics position. Even thought it does not directly require programming skills your helped me to stay motivated, opened up opportunities for automation and inspired to do some interesting projects. Thanks again and keep it up!

  • @JohnWatsonRooney

    @JohnWatsonRooney

    2 жыл бұрын

    Thank you, very kind! I’m glad you have enjoyed my videos

  • @beware5159
    @beware51592 жыл бұрын

    Great Work Man! Always right to the point and no fillers. Thanks for you hard work 🙌!

  • @JohnWatsonRooney

    @JohnWatsonRooney

    2 жыл бұрын

    Thanks!

  • @danlee1027
    @danlee1027 Жыл бұрын

    Very helpful as usual. I look forward to your Playwright series

  • @nch77884
    @nch77884 Жыл бұрын

    no nonsense and to the point short video. thanks John

  • @JohnWatsonRooney

    @JohnWatsonRooney

    Жыл бұрын

    Thanks for watching!

  • @franky12
    @franky122 жыл бұрын

    Great video and practical example! Would like to see more advanced stuff with playwright.

  • @BartVanLandschoot
    @BartVanLandschoot Жыл бұрын

    After seeing many videos and trials to do web scraping on secured websites, this has finally brought the solution. Thank you so much! Attention on cookies: Playwright acts as a new/clean browser. So opening a website from the script is like visiting it for the first time. I discovered that the website I wanted to scrape, started with a cookie banner that you have to click. So before filling in the username and password, I had to do a page.click('button#btn-accept-cookies')

  • @JohnWatsonRooney

    @JohnWatsonRooney

    Жыл бұрын

    Thanks! Good tip too thank you for sharing

  • @PaulDenman
    @PaulDenman Жыл бұрын

    Excellent tute John, thank you for such clarity

  • @andro_id
    @andro_id2 жыл бұрын

    My first intro into Playwright :) It's awesome, thank you!

  • @JohnWatsonRooney

    @JohnWatsonRooney

    2 жыл бұрын

    Glad you like it!

  • @David-mj9st
    @David-mj9st2 жыл бұрын

    It's my luck to find your video,it make me learn python much easer.THANKS!

  • @JohnWatsonRooney

    @JohnWatsonRooney

    2 жыл бұрын

    That’s great I’m glad you found it!

  • @Abdul_Rafay_Pal
    @Abdul_Rafay_Pal Жыл бұрын

    Thank you very much. You made things so much simple, easy Thanks a lot

  • @Saeed-ko9wp
    @Saeed-ko9wp7 ай бұрын

    thanks john useful as usual

  • @JohnWatsonRooney

    @JohnWatsonRooney

    7 ай бұрын

    Glad you enjoyed it

  • @andres777video
    @andres777video Жыл бұрын

    I like this, very useful, and it can be combined with Selenium if desired...

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

    Thank you so much. It helped me a lot..

  • @dennistanui7085
    @dennistanui70852 жыл бұрын

    Thanks for sharing these awesome tutorials. You sir, are a gem

  • @JohnWatsonRooney

    @JohnWatsonRooney

    2 жыл бұрын

    Glad you like them!

  • @kthehatter
    @kthehatter2 жыл бұрын

    hey great video i loved it just wondering if it's possible to open multiple tabs simultaneously ?

  • @ferilukmansyah249
    @ferilukmansyah2492 жыл бұрын

    Thanks for sharing john, this is a great tutorial ever

  • @JohnWatsonRooney

    @JohnWatsonRooney

    2 жыл бұрын

    You are very welcome

  • @AshleyMush
    @AshleyMush8 күн бұрын

    Wow, this is much cleaner than selenium

  • @tonymudau3005
    @tonymudau3005 Жыл бұрын

    Thank you my brother!

  • @priyankarajput2208
    @priyankarajput2208 Жыл бұрын

    Great video!!....is there more tutorials/videos on playwright (for scraping)?

  • @Ardassali
    @Ardassali2 жыл бұрын

    Thanks! Master Rooney.

  • @LucLev
    @LucLev Жыл бұрын

    I've been religiously watching your videos for the last week or so. Such a great source of information, you're a great teacher, very direct and to the point! I've succesfully set up a project scraping data from betting sites to find arbitrage opportunities - mainly via hidden API's. But some pesky websites seem to restrict their APIs - hoping to solve this with playwright :).

  • @JohnWatsonRooney

    @JohnWatsonRooney

    Жыл бұрын

    Thanks a lot I appreciate it! Good luck with your projects!

  • @haideralihassan5053
    @haideralihassan50532 жыл бұрын

    Very informative video. Looking for more videos on playwright.

  • @JohnWatsonRooney

    @JohnWatsonRooney

    2 жыл бұрын

    More to come!

  • @locopollo666
    @locopollo6662 жыл бұрын

    Great video! Thanks

  • @JohnWatsonRooney

    @JohnWatsonRooney

    2 жыл бұрын

    You're welcome!

  • @androidmod183
    @androidmod1832 жыл бұрын

    Thank you for sharing, i like your channel. Keep it up mate.

  • @Nabilh17
    @Nabilh17 Жыл бұрын

    very interesting, thank you

  • @marcoalmeida2136
    @marcoalmeida21369 ай бұрын

    Dropping by to say thank you for this tutorial!!!! And also ask which theme did you use?

  • @JohnWatsonRooney

    @JohnWatsonRooney

    9 ай бұрын

    Thanks- it’s one of the GitHub themes, my favourite for vs code at the moment

  • @kacheck855
    @kacheck8552 жыл бұрын

    Thank you John, please make more videos of playwright.

  • @JohnWatsonRooney

    @JohnWatsonRooney

    2 жыл бұрын

    Yes more coming!

  • @engineerbaaniya4846
    @engineerbaaniya48462 жыл бұрын

    Amazing content Thanks sir

  • @stewart5136
    @stewart5136 Жыл бұрын

    10 out of10 again! Haven't installed Playwright yet and wondered how you found it for speed vs Selenium? In an earlier reply you mention that you prefer PyCharm now over VS Code. Will the community version work for most or do we need the Pro version?

  • @JohnWatsonRooney

    @JohnWatsonRooney

    Жыл бұрын

    I think it’s about the same speed wise I just find it much easier to work with - yes PyCharm community is good it’s what I use!

  • @actionknight93
    @actionknight93 Жыл бұрын

    Thanks a lot!

  • @jacoby8934
    @jacoby8934 Жыл бұрын

    Great video mate! really helpful! Question - any idea how page content can be displayed while using pytest with bs4? my tests passing successfully but i can't "scrape" data from websites so i can't see all the information in the inner_html. I'm using vscode both as IDE and terminal and besides passed tests in terminal, there is no other information. any ideas?

  • @__-tq3lm
    @__-tq3lm7 ай бұрын

    thank you so much

  • @danielrosas2240
    @danielrosas22402 жыл бұрын

    AWESOME!!!! 🙌🙌🙌

  • @Mreto17
    @Mreto176 ай бұрын

    Thanks John for sharing. How can I reuse the login session?

  • @horus4862
    @horus48622 жыл бұрын

    Nice!

  • @jarekmor
    @jarekmor Жыл бұрын

    Beautiful!!! 🙂

  • @jarekmor

    @jarekmor

    Жыл бұрын

    John, no words to thank you for all your tutorials! I hope you will show us more cases based on playwright. Thank you!!!

  • @KendaBeatMaker
    @KendaBeatMaker2 жыл бұрын

    Thanks 😁

  • @seyproductions
    @seyproductions Жыл бұрын

    Hi, does Playwright or its browser(s) need to be updated when a newer version of the browser that we are using for the scraping gets released?

  • @cassiolacaz
    @cassiolacaz2 жыл бұрын

    As always, a great video John! As an expert in Requests, do you know if it is possible to use Playwright together with Requests? Tks

  • @abel4776

    @abel4776

    Жыл бұрын

    Requests if no JavaScript. Playwright if JavaScript. ALTHOUGH I still believe there is a way to pull data in JavaScript that has no API/JSON WITHOUT rendering.

  • @martpagente7587
    @martpagente75872 жыл бұрын

    Well done John, thank you so much . How fast is it Vs selenium?

  • @JohnWatsonRooney

    @JohnWatsonRooney

    2 жыл бұрын

    it's still got to open and run a browser but so far I think its faster

  • @muhammadazmulhaq
    @muhammadazmulhaq2 жыл бұрын

    Good competition between Cypress vs Playwright vs Selenium. Thanks for this video. Love from Pakistan 🇵🇰

  • @fernandomdcn2920
    @fernandomdcn2920 Жыл бұрын

    Thanks, Koushig. I have a question: When I log into google I get the following message: "This browser or app may not be secure" error when trying to sign in with Google on desktop apps

  • @maxpenfold8699
    @maxpenfold86992 жыл бұрын

    Nice Video

  • @irfanshaikh262
    @irfanshaikh262 Жыл бұрын

    Hey John, I was precisely looking up for a technique like this for an upcoming project I'm aligned to where we need to login inside one of our company's internal web tool and scrape the leads generation table that appears post loggin in, write it to an excel file and resulting file will be attached to a Bi dashboard for automatic updates and publishing. Will this technique of yours work or would you care to give some more of yours experts advice? Thanks for being there. As a self taught pyhtoneer new to programming, you give me a lot of hope with your content. Thanks for being there for people like me. ❤❤❤❤

  • @gauravpainuly1800
    @gauravpainuly18002 жыл бұрын

    subscribed....... please keep on making videos like that ...thanks

  • @JohnWatsonRooney

    @JohnWatsonRooney

    2 жыл бұрын

    Thank you!

  • @luongvanhuy5365
    @luongvanhuy53652 жыл бұрын

    Thanks for your great video. I have 2 problems can you help me about it: 1. Use playwright to crawl website. But after click on button --> ajax call --> how i can reload data from ajax response. 2. After use playwright to login, can we use scrapy to send new request and crawl data.

  • @bozok1903
    @bozok1903 Жыл бұрын

    It look much easier and cleaner than selenium. Thanks for the great video.

  • @JohnWatsonRooney

    @JohnWatsonRooney

    Жыл бұрын

    Thanks, that’s why I like it more

  • @KendaBeatMaker
    @KendaBeatMaker2 жыл бұрын

    Getting Selenium running on Google Cloud Platform was so much stress. Last night I setup Playwright with no stress, no extra work was needed.

  • @JohnWatsonRooney

    @JohnWatsonRooney

    2 жыл бұрын

    That’s great!

  • @abel4776

    @abel4776

    Жыл бұрын

    Key Ken, interested to know why was it stressful? Was it the Google permissions and what not?

  • @statsnow3354
    @statsnow33542 жыл бұрын

    Hi, John can you make a video about asynchronous playwright to scrape multiple URLs?

  • @junivensaavedra882
    @junivensaavedra882 Жыл бұрын

    Hi John, I would like to ask if you still use Playwrite? or do you have new favorite? Like the tools I learn from you httpx and selectolax.

  • @JohnWatsonRooney

    @JohnWatsonRooney

    Жыл бұрын

    I sure do. If I need to run a headless browser I use playwright the other tools like httpx and selectolax do different things and are my go to for making requests and parsing html

  • @junivensaavedra882

    @junivensaavedra882

    Жыл бұрын

    @@JohnWatsonRooney thank you very much for responding. :)

  • @youandainews
    @youandainews Жыл бұрын

    Mate you're the best for this stuff. Your deadpan style also makes me laugh. I bet you have a wicked sense of humour. Remind me of the russians. Dry as anything, and wizards with code!

  • @JohnWatsonRooney

    @JohnWatsonRooney

    Жыл бұрын

    Thanks! I try not to take myself too seriously!

  • @AnimationLook
    @AnimationLook5 ай бұрын

    Hello, please tell me, is it possible to somehow get the har file of a browser page without browsermob proxy?

  • @mdarifurrahmananik3973
    @mdarifurrahmananik39737 ай бұрын

    you are the magician boss :)

  • @rajkumarguptafx3907
    @rajkumarguptafx3907 Жыл бұрын

    Hii..Mr. John, I'm working on a playwright Python project where I want to print the response.json() of a particular response. Kindly make a video on the request-response in the playwright.

  • @rajeevmenon1975
    @rajeevmenon19752 жыл бұрын

    I am logging to a site with 2F authentication. First there is a captcha and then after keying captcha there is an OTP. How do we code to accept user input of captcha and OTP (selenium or playwright)? Help will.be appreciated

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

    Finally my Selenium webdriver headache has gone :D

  • @user-fh6kh5ke9h

    @user-fh6kh5ke9h

    Ай бұрын

    Any advice on getting Chromium driver to work? Webkit will work ;-)

  • @user-fh6kh5ke9h

    @user-fh6kh5ke9h

    Ай бұрын

    An afternoon, cookie session, soup, json, all pushed to Google sheets webapp.. Loving this!

  • @enamils
    @enamils6 ай бұрын

    Realy help me thanks a lot i need to hide browser page after connect in for loop

  • @truonganhuynh9161
    @truonganhuynh91612 жыл бұрын

    i got trouble, RuntimeError: Event loop is closed, when i ran the code in 7:28p. what are these errors?

  • @melih.a
    @melih.a2 жыл бұрын

    I'm wondering how we could scrape multiple pages, I've watched the crawl and follow links with scrapy video but I don't know if FormRequest is the way to go instead of playwright.

  • @abel4776

    @abel4776

    Жыл бұрын

    Depends if you are scraping a pure html site or a JavaScript html site.

  • @satwikawasthi2002
    @satwikawasthi20029 ай бұрын

    i am facing huge gap of loading a secong page after a first page with this method and still nothing is printing in console, please help what to do

  • @ollie_the_wandererli7523
    @ollie_the_wandererli7523 Жыл бұрын

    wow! cooooool

  • @vt2788
    @vt27882 жыл бұрын

    Great! How do you decide whether to use playwright+bs or scrapy?

  • @JohnWatsonRooney

    @JohnWatsonRooney

    2 жыл бұрын

    Thanks! Depends what I am trying to achieve. If it’s something like this I wouldn’t bother with Scrapy. One of the videos coming up with be scrapy + playwright

  • @vt2788

    @vt2788

    2 жыл бұрын

    @@JohnWatsonRooney cool! Looking forward to that! I digged through your videos and got a bit confused with Itemloader. Should i use it if I just have to get just very static job info? I don't really need to process the data

  • @JohnWatsonRooney

    @JohnWatsonRooney

    2 жыл бұрын

    @@vt2788 if your project is working for you without it then no don;t worry. it does make is easier when adding to databse etc as you can use it to clean your data out properly and stucture it

  • @vt2788

    @vt2788

    2 жыл бұрын

    @@JohnWatsonRooneyBrilliant! Okay, I see how I could customize my scraping that way. Thanks so much!

  • @ClarkWu-mx3zk
    @ClarkWu-mx3zk Жыл бұрын

    Great video! BTW, can it log in website with recaptcha?

  • @ho0k17

    @ho0k17

    2 ай бұрын

    No, recaptcha is not supported by selenium

  • @Wassilvideos
    @Wassilvideos2 жыл бұрын

    thanks bro, do you have any idea how to bypass a captcha with playwright ?

  • @boriscabrera2947

    @boriscabrera2947

    Жыл бұрын

    you resolved ?

  • @tolulopeayemobola1446
    @tolulopeayemobola14462 жыл бұрын

    Nice video. Is there a java equivalent for this? I also would like to have a word or two with you

  • @JohnWatsonRooney

    @JohnWatsonRooney

    2 жыл бұрын

    Playwright works with Java - playwright.dev/java/ You can email me if you like my email is on my main YT page.

  • @tolulopeayemobola1446

    @tolulopeayemobola1446

    2 жыл бұрын

    @@JohnWatsonRooney Thank you John. I emailed but I am yet to get a response from you. Just thought to reach out and let you know

  • @jobinnelson
    @jobinnelson2 жыл бұрын

    which theme are you running on vs code?

  • @JohnWatsonRooney

    @JohnWatsonRooney

    2 жыл бұрын

    It’s one of the GitHub official themes, i quite like it

  • @MeMonarch
    @MeMonarch10 ай бұрын

    i write the exact same code but it doesnt seems to be working.can you help me out,John?

  • @leventbozkurt9796
    @leventbozkurt97962 жыл бұрын

    John you are a great teacher. Thanks for your efforts. Can you please make a video for Amazon and Playwright. you know Black days are coming. Thanks

  • @Islamallam99
    @Islamallam992 жыл бұрын

    I have faced this error while applying the code, any suggestion? Looks like Playwright was just installed or updated. ║ ║ Please run the following command to download new browsers

  • @ruthlessmarketresearch4957
    @ruthlessmarketresearch4957 Жыл бұрын

    what code editor do you use?

  • @JohnWatsonRooney

    @JohnWatsonRooney

    Жыл бұрын

    This is VS Code with one of the Github Themes - Dark Dimmed I believe. Honestly I prefer PyCharm nowadays

  • @idcemail123
    @idcemail123 Жыл бұрын

    I scraped a site with playwright inside my express js app.get() function. How would i deploy this scraped data to a website such as vercel? It works locally but when i try to host it on heroku i just get error 500 ?

  • @JohnWatsonRooney

    @JohnWatsonRooney

    Жыл бұрын

    It’s probably because the host ip on heroku has already been blocked from accessing the site. Cos it’s shared ip it’s fairly common- you’ll need to use proxies to bypass this

  • @joeb.1163
    @joeb.11632 ай бұрын

    Can playwright be pointed to the browser installed on the machine instead of the one that is playwright installs?

  • @JohnWatsonRooney

    @JohnWatsonRooney

    2 ай бұрын

    Yes you can connect via cdp(?) protocol to a running browser - it’s in the docs somewhere I’m sure

  • @remaksiva
    @remaksiva2 жыл бұрын

    Спасибо!

  • @gorilaz0n
    @gorilaz0n Жыл бұрын

    Hi John. When I got the the line, sync_playwright, I got the error, saying that I was using the sync api inside the asyncio loop. Do you know how to resolve it?

  • @gorilaz0n

    @gorilaz0n

    Жыл бұрын

    That and the AttributeError: “PlaywrightContextManager” object has no attribute “_playwright”

  • @abdulwali4920
    @abdulwali4920 Жыл бұрын

    Traceback (most recent call last): File "c:\Users\Sellitrage\Desktop\playwright test1\main.py", line 1, in from playwright.sync_api import sync_playwright File "C:\Users\Sellitrage\AppData\Local\Programs\Python\Python310\lib\site-packages\playwright\sync_api\__init__.py", line 25, in facing this error while running dont know how to solve this....please guide me.

  • @zwykyziomek2570
    @zwykyziomek2570 Жыл бұрын

    wow how do you run headed browser just like that? on my wsl it wants me to xvfb-run (whatever this is) for some reason

  • @JohnWatsonRooney

    @JohnWatsonRooney

    Жыл бұрын

    I think it works differently in WSL - if you did it on windows or Linux it would work just like this

  • @zwykyziomek2570

    @zwykyziomek2570

    Жыл бұрын

    @@JohnWatsonRooney i must try that then, thx

  • @ghabcdef
    @ghabcdef Жыл бұрын

    Thanks for the tutorial... I think the demo site has changed though, the last part of the script does not work. In particular the html output of page.inner_html('#content') looks nothing like the demo and the subsequent steps do not return the results in the tutoral.

  • @JohnWatsonRooney

    @JohnWatsonRooney

    Жыл бұрын

    thanks. unforuntately this is often the case, things change- this is why i try to demo the methods rather than specific sites. but it just furthers the need for me to build my own web scraping test site!

  • @garymichalske2274

    @garymichalske2274

    Жыл бұрын

    @@JohnWatsonRooney I have the same issue. Although it doesn't make sense because I can see the h2 tags in the html enclosed in online. It seems like playwright is ignoring the h2 tags. When I print(html) after the line html = page.inner_html('#content'), the result in the editor does not show any h2 tags. It doesn't come close to the section of code I see online.

  • @saadachab8425
    @saadachab84252 жыл бұрын

    Hello John, please can playwright scrap Angular web pages?

  • @JohnWatsonRooney

    @JohnWatsonRooney

    2 жыл бұрын

    Yes it should easily be able too - angular is a JavaScript framework so playwright is a good option.

  • @oleksandrbondarenko9632
    @oleksandrbondarenko96322 жыл бұрын

    I ger error RuntimeError: Event loop is closed sys:1: RuntimeWarning: coroutine 'Page.goto' was never awaited Can you help me?

  • @scientificapproach6578
    @scientificapproach6578 Жыл бұрын

    Using code in video I get this error, how do I fix, thanks. page = browser.new_page() ^ SyntaxError: invalid syntax

  • @sinajry8309
    @sinajry83092 жыл бұрын

    great video sir...could you pls make a video about scrolling and scraping an infinite webpage like instagram...ill appreciate it...tnx

  • @anonymoususer8849
    @anonymoususer88492 жыл бұрын

    Which theme you use?

  • @JohnWatsonRooney

    @JohnWatsonRooney

    2 жыл бұрын

    That one is one of the GitHub themes

  • @anonymoususer8849

    @anonymoususer8849

    2 жыл бұрын

    @@JohnWatsonRooney okay thanks. it's really good theme

  • @karthikshaindia
    @karthikshaindia2 жыл бұрын

    Nice... How unique with helium? Seems bit lazy code ;) compared your tutorial. I'll try my end.

  • @pratikshagarkar986
    @pratikshagarkar9862 жыл бұрын

    This video is also awesome. Thanks for sharing your knowledge with us. But I got the following error. Can you please help me for solving the error? File "D:\Project\My_Py\untitled2.py", line 10, in with sync_playwright() as p: File "C:\Users\user\Anaconda3\lib\site-packages\playwright\sync_api\_context_manager.py", line 45, in __enter__ raise Error( Error: It looks like you are using Playwright Sync API inside the asyncio loop. Please use the Async API instead.

  • @JohnWatsonRooney

    @JohnWatsonRooney

    2 жыл бұрын

    Hmm are you running this in a Jupiter notebook or similar?

  • @onapmek8763
    @onapmek87632 жыл бұрын

    Using jupyter notebook, I get: "It looks like you are using Playwright Sync API inside the asyncio loop. Please use the Async API instead."

  • @JohnWatsonRooney

    @JohnWatsonRooney

    2 жыл бұрын

    Hey so I don’t think you can use this with jupyter due to the way the internal loop is used, you’d have to write your own script instead in a py file

  • @onapmek8763

    @onapmek8763

    2 жыл бұрын

    @@JohnWatsonRooney Thanks and thanks for your video! I've read the same thing online, I'll try and see if it works in the a py file

  • @MancePlays
    @MancePlays2 жыл бұрын

    Guys, please help me! Let's take a simple scenario, open a browser, go to google, search for 'word', press search, and the scripts ends. In selenium, after the search, the browser is still open and usable, i can browse through the search results. In playwright, the browser closes, even if i did not us browser.close(). How can I keep my browser open and analyze the search results of my google query?

  • @JohnWatsonRooney

    @JohnWatsonRooney

    2 жыл бұрын

    Hey! It’s being run in the context manager which automatically closes the browser when the code is finished. In the docs there is a bit about running it without the context manager this is what you want

  • @MancePlays

    @MancePlays

    2 жыл бұрын

    @@JohnWatsonRooney I have no idea what you mean :) but I will dig around!

  • @JohnWatsonRooney

    @JohnWatsonRooney

    2 жыл бұрын

    @@MancePlays no problem, look here: playwright.dev/python/docs/intro and go to the section "Interactive mode (REPL)". this code will work in your code editor too and you should be able to take it from there

  • @zakyvids6566
    @zakyvids65662 жыл бұрын

    Thanks for sharing this video I was wondering can you please make a short maybe an hour long python crash course Thanks a lot

  • @JohnWatsonRooney

    @JohnWatsonRooney

    2 жыл бұрын

    I’ve thought about it but I wasn’t sure as there are lots of good videos out there already like that. You’ve given me some good idea though

  • @TheTruepikvic
    @TheTruepikvic10 күн бұрын

    What about captcha?

  • @demircan9464
    @demircan9464 Жыл бұрын

    total_orders = soup.find('h2', {'class': 'pull-right'}).text AttributeError: 'NoneType' object has no attribute 'text' what's the reason of this ?

  • @abel4776

    @abel4776

    Жыл бұрын

    take out .text and try again.

  • @_manasikara

    @_manasikara

    Жыл бұрын

    @@abel4776 same here, but after removing the 'text' I got as a result: "total orders = None". The code is exactly the same as show in the video.

  • @kgztn
    @kgztn2 жыл бұрын

    I keep getting No module named 'playwright'

  • @KhalilYasser
    @KhalilYasser2 жыл бұрын

    Thank you very much for the awesome tutorials. I have tested the code and I got a result but after the result, I got such a message RuntimeError: Event loop is closed

  • @KhalilYasser

    @KhalilYasser

    2 жыл бұрын

    I have searched and could solve that by adding this line `import asyncio`

  • @JohnWatsonRooney

    @JohnWatsonRooney

    2 жыл бұрын

    ok good, i didnt have that error but good to know thanks

  • @ehernandezvilla

    @ehernandezvilla

    2 жыл бұрын

    ​@@KhalilYasser do you have the example of the lines you added to the code? I have the same issue :(

  • @KhalilYasser

    @KhalilYasser

    2 жыл бұрын

    @@ehernandezvilla The same code used in the video exactly but add `import asyncio` at the declaration part.

  • @breal1460
    @breal1460 Жыл бұрын

    Unfortunately, this project is not working purposes... The sites I need to log in to say these browsers are outdated... :(

  • @JohnWatsonRooney

    @JohnWatsonRooney

    Жыл бұрын

    Really? That’s odd, try reinstalling playwright it should fetch the latest version of chrome

  • @Achiesamablog
    @Achiesamablog2 жыл бұрын

    Is there place hiring scrapers ?

  • @onapmek8763

    @onapmek8763

    2 жыл бұрын

    what?

  • @adnanpramudio6109
    @adnanpramudio61092 жыл бұрын

    Great content as always john. Can you cover about record command codegen in playwright? python -m playwright codegen --help Usage: index codegen [options] [url] -o: save the recorded script to a file --target: Specifies the language for generating scripts, there are two types of JS and Python, the default is Python -b: Specify the browser driver Example : python -m playwright codegen --target python -o 'main.py' -b chromium www.youtube.com

  • @JohnWatsonRooney

    @JohnWatsonRooney

    2 жыл бұрын

    Thanks! Sure that’s the topic for part 2 !

  • @adnanpramudio6109

    @adnanpramudio6109

    2 жыл бұрын

    Awesome, i hope you can cover about how to scroll down as in selenium, since I was struggling how to do it in playwright

  • @naveenkumargembali3494
    @naveenkumargembali34942 ай бұрын

    How to scrape data without opening browser

  • @Leoyenet6850

    @Leoyenet6850

    Ай бұрын

    Requests lib and bs4 or scrapy or headless

  • @NedimMalik
    @NedimMalik2 жыл бұрын

    I found Helium work better for me

  • @JohnWatsonRooney

    @JohnWatsonRooney

    2 жыл бұрын

    That’s great use what works best for you

  • @NedimMalik

    @NedimMalik

    2 жыл бұрын

    @@JohnWatsonRooney I was wrong, Playwright is better, I dont need to scroll down till the button is visible to click it

Келесі