THIS is Playwrights BEST Feature for Web Automation

แชร์
ฝัง
  • เผยแพร่เมื่อ 24 พ.ย. 2024

ความคิดเห็น • 90

  • @reymartpagente9800
    @reymartpagente9800 3 ปีที่แล้ว +16

    It's a game-changer! Imagine how much time we save by this feature. Thank you so much John as always.

  • @northerngannet5775
    @northerngannet5775 2 ปีที่แล้ว +4

    Brilliant, I love that John seems so non-chalant while dropping a game-changing feature. Thanks for sharing!!!

  • @disk38
    @disk38 3 ปีที่แล้ว +7

    Amazing video!
    I really like all of your videos and consider you my most favorite code tutor, you have a very understandable and hardworked content.
    Thank you very much for your great journey on webscraping world, i will always awe you for the knowledge you share and efforts you give to find them.
    Thanks truly.

  • @adnanpramudio6109
    @adnanpramudio6109 3 ปีที่แล้ว +1

    Thanks john for covering about scroll down and up

  • @Analyse_US
    @Analyse_US 2 ปีที่แล้ว +1

    This makes my brain want to explode! This is amazing, so many potential applications. Thanks!

  • @meg6pat
    @meg6pat ปีที่แล้ว +1

    Super useful session. Great example of creating good and not a flaky scenario. Thank you very much.

  • @stewart5136
    @stewart5136 2 ปีที่แล้ว +2

    Thanks John 👍👍
    The website has changed and while I couldn't follow your example exactly I did use the codegen and extracted the total price of the cart. Couldn't use page.query_selector and instead used:
    page.frame_locator("#iFrameResizer0").locator('div[data-test=cart-total] span[data-test=cart-price-value]').text_content()
    Seems a bit messy and can understand why it might be easier to get it to BeautifulSoup.
    Thanks again. Great video and great tool.

    • @JohnWatsonRooney
      @JohnWatsonRooney  2 ปีที่แล้ว

      That’s great! I find this sort of method, especially using codegen is best for automating tasks rather than information gathering - which I much prefer to do other ways like you mentioned

  • @mohfatkurrozi4069
    @mohfatkurrozi4069 3 ปีที่แล้ว +1

    Im from indonesian.. really good information... still wait to scrape data with this method.. good bless for you.. you save my time🥰

    • @JohnWatsonRooney
      @JohnWatsonRooney  3 ปีที่แล้ว +1

      Thank you for watching I’m glad you liked it!

  • @AleemAhmed-g3n
    @AleemAhmed-g3n ปีที่แล้ว

    Nice. Didn't knew playwright had that feature!

  • @michaeldacosta7504
    @michaeldacosta7504 3 ปีที่แล้ว +1

    Very fancy. Thanks for the video!

  • @zakyvids6566
    @zakyvids6566 3 ปีที่แล้ว +1

    Hi Thanks for sharing this
    In your previous vid I had commented about an 30 minute to hour long python crashcourse
    I’m aware that there are quite a lot of videos out there but I feel like your way of explaining is very clear and concise
    As for playwright I really like the video and would love to see more of this

    • @JohnWatsonRooney
      @JohnWatsonRooney  3 ปีที่แล้ว

      Thanks I really appreciate your feedback, I've started writing down ideas for a Python crash course, I think if I choose the right topics it will work.

  • @lostfsoul
    @lostfsoul 3 ปีที่แล้ว +2

    Like always John great content !

  • @lowkeylyesmith
    @lowkeylyesmith ปีที่แล้ว +1

    thumbs up and subscribed, thank you for your videos

  • @CodePhiles
    @CodePhiles 3 ปีที่แล้ว +1

    brilliant, Thanks for sharing this video

  • @narutocole
    @narutocole 3 ปีที่แล้ว +2

    Ok yeah you just talked me in to switching to playwright lol

    • @JohnWatsonRooney
      @JohnWatsonRooney  3 ปีที่แล้ว +1

      I’m really enjoying working with it!

  • @tubelessHuma
    @tubelessHuma 3 ปีที่แล้ว +1

    No doubt it is a great feature. It will make our life easy. 👌💖

  • @Explore4code
    @Explore4code 7 หลายเดือนก่อน

    So powerful. I really appreciate it 🙏🏼🙏🏼

  • @internetuser4689
    @internetuser4689 3 ปีที่แล้ว +8

    I think that playwright is a nice automation tool but the documentation and the amount of tutorial are kinda scarce when we talk about Python with Pytest and playwright.
    Also hard to find tutorials about page object model witb python/playwright.
    Basically playwright is new and shiny but comes at a cost.
    The developers of playwright mostly work in JavaScript, which I don't use.

    • @markcuello5
      @markcuello5 2 ปีที่แล้ว

      What`s the difference between Python and Pytest?

    • @internetuser4689
      @internetuser4689 2 ปีที่แล้ว +3

      @@markcuello5 Python is a programming language.
      Pytest is a testing framework in Python.

  • @Cheerfulnag
    @Cheerfulnag 3 ปีที่แล้ว +2

    Are there any reasons now to use selenium at all? I mean it was useful only if you need to click something or input, but playwright can do that now.

    • @JohnWatsonRooney
      @JohnWatsonRooney  3 ปีที่แล้ว +1

      I don’t have any reason to use selenium anymore. It does do the same thing but playwright feels better to me, and easier to use too.

    • @internetuser4689
      @internetuser4689 3 ปีที่แล้ว +2

      Selenium is still the de facto automation tool.
      Playwright might be the new kid on the block but Selenium is still solid.

  • @amitwali6844
    @amitwali6844 2 ปีที่แล้ว

    Great video! What did you do with those 3 jackets? 😅

  • @maryamlarijani5550
    @maryamlarijani5550 8 หลายเดือนก่อน

    Thanks for your video! question: can we use toBeVisible() method instead of click(), when we are checking presence of element in the page?

  • @domenechj
    @domenechj 3 ปีที่แล้ว +1

    Great video! Thank you for sharing! How does playwright handle waits?

    • @JohnWatsonRooney
      @JohnWatsonRooney  3 ปีที่แล้ว

      Thanks! You can use the “is visible” on an element and it will wait until that specific element is shown

  • @dand4485
    @dand4485 ปีที่แล้ว +1

    Nice video, while i would suggest putting the sleep in to wait is a bad practice. For demonstrating something okay got it... While i'd suggest you would have a method that would use other functions available in PW to test the item/screen element is visible... Sorry don't know python but the pseudo code would be:
    public boolean SeekButtonAndClick( page, locatorString )
    {
    let elementToFind = page.locator( locatorString) ;
    let screenHeight = elementToFind.boundingBox().height;
    let currentTop = -1;
    let windowTop = elementToFind.evaluate( node => window.top ) ; /* current display top */
    while( elementToFind.isVisible( options.Timeout) is false and
    currentTop != windowTop )
    {
    page.Wheel( 0, screenHeight) ;
    windowTop = elementToFind.evaluate( node => window.top ) ;
    }
    if (elementToFind.isVisible() )
    {
    elementToFind.Click();
    return true for success...
    }
    else
    {
    return false...
    }
    }
    Given the calling routine should have the page... Pass in the locator's string for the element that will come into view.
    We get the bindingbox of the screen Height and Width to know the height to scroll down, could send keyboard('page down') too. We then loop seeking to make sure the element is visible. The windowTop and currentTop prevent in an infinite loop either the control will scroll in and the position updates or not, if it does it will be clicked and return. Otherwise never found and that page won't scroll further return false. The evaluate should use the browser's window that will be the current view port of the browser window displayed... Scrolling down should increase it shouldn't be < 0, so we use -1 to ensure one execution.
    This has no explicit wait and should work well.

    • @JohnWatsonRooney
      @JohnWatsonRooney  ปีที่แล้ว

      Thanks for the detailed response and you absolutely right, using time is a very bad idea and was used for demonstration purposes only. I would always recommend a wait on element or network use and an error handler for better code.

    • @dand4485
      @dand4485 ปีที่แล้ว +1

      @@JohnWatsonRooney True, bet even my suggestion could be improved. I'm only worried, as a contractor people see the time and just put that in code and move on... It works... Difference is like one project i had people put in timer/waits with them took 1.5 hours, waiting on elements as we both agree the way to go, it now runs in about 7 minutes :)

  • @inakisehernandez5220
    @inakisehernandez5220 ปีที่แล้ว

    Hi John! A very big fan here.
    Very helpfull information, but what if there’s a captcha that we need to break?

  • @jakeliujakeliu
    @jakeliujakeliu 2 ปีที่แล้ว +1

    Can you create a video show best way to prevent site detecting you from using scrapping bot? I try a project before using different way to get Zillow data for project, but keep pop up captcha.

    • @markcuello5
      @markcuello5 2 ปีที่แล้ว

      What is `Zillow data`?

    • @abbaskhan5456
      @abbaskhan5456 10 หลายเดือนก่อน

      For the rough idea
      You can use existing chrome/Firefox browser with remote defined port so that you can do your work after captache
      I did the same when I was working with selenium and the same bot detection issue I was facing so that existing browser use helped a lot to me🙂

  • @statsnow3354
    @statsnow3354 3 ปีที่แล้ว +2

    Hey man, can you do a video about scraping with asynchronous playwright?

    • @JohnWatsonRooney
      @JohnWatsonRooney  3 ปีที่แล้ว +4

      Hey yeah sure i have a few more videos on my playwright series I’ll be sure to cover async

    • @statsnow3354
      @statsnow3354 3 ปีที่แล้ว +1

      Looking forward to it. Planning to ditch Selenium.

    • @markcuello5
      @markcuello5 2 ปีที่แล้ว

      What is `Scraping`?

  • @jimmedlock6004
    @jimmedlock6004 9 หลายเดือนก่อน

    I'm trying to automate saving of a video clip via a web UI that gets clips from a server. The mpeg video doesn't load in chromium. Is there a way to record the code using chrome?

  • @legallyinsane205
    @legallyinsane205 3 ปีที่แล้ว

    Hi how can we do this with playwright or if is it even possible? in Scrapy response.replace(body=webdriver.page_source) using selenium, how can we do this with playwright, i tried response.replace(body=page.content()) but this doesn't work, kindly help!

  • @mihaissv9469
    @mihaissv9469 ปีที่แล้ว +1

    lovely!

  • @hubttech7854
    @hubttech7854 ปีที่แล้ว

    Hi sir , can you make a video how to recaptcha bypass in airline website. Eg recaptcha inside the home page in bottom in right or left corner., and seen in monitoring request

  • @vincentdigiusto9429
    @vincentdigiusto9429 2 ปีที่แล้ว +1

    thank you great video as always. To avoid scolling issues is it possible to set the height of browser window to a very big value ? (2000, 4000....)

    • @JohnWatsonRooney
      @JohnWatsonRooney  2 ปีที่แล้ว

      I think that is possible but I haven’t tried to see what the limit is!

    • @Analyse_US
      @Analyse_US 2 ปีที่แล้ว

      That was my thought as well. Don't suppose you tested the idea? Super curious

    • @vincentdigiusto9429
      @vincentdigiusto9429 2 ปีที่แล้ว +1

      @@Analyse_US I tried, seems that we are limited to screen size, but there is a workaround, you can modify the zoom level (10% or less), it is like having a huge browser window

    • @Analyse_US
      @Analyse_US 2 ปีที่แล้ว

      @@vincentdigiusto9429 Thanks!

  • @learncodeinbangla1852
    @learncodeinbangla1852 3 ปีที่แล้ว

    I am very gratefull to you for this video. Could you please make a video how can I upload this code in a server??
    Thanks again.

  • @MrTASGER
    @MrTASGER 3 ปีที่แล้ว

    How connect to existing browser? I want that 2 scripts use 1 browser with 2 tabs.

  • @yavuzobuz2405
    @yavuzobuz2405 4 หลายเดือนก่อน

    "I've developed a web application using Playwright for automation testing. Could you provide guidance on how I can reliably deploy this application to a production environment, ensuring it runs smoothly and securely? What best practices or strategies would you recommend for deploying a Playwright-based application to a production server or hosting platform?"
    The key points in this question are:
    You have developed a web application using Playwright for automation testing.
    You need guidance on how to deploy this application to a production environment.
    You want the application to run smoothly and securely in production.
    You're looking for best practices or strategies for deploying a Playwright-based application to a production server or hosting platform.
    Please let me know if you would like me to modify or expand the question in any way. I'm happy to provide an English language question that captures the essence of what you need to ask the TH-cam user.

  • @_elkd
    @_elkd 2 ปีที่แล้ว +2

    Wow

  • @vikramgupta5958
    @vikramgupta5958 ปีที่แล้ว

    How can we generate code for device like iphone

  • @FCHFlo123
    @FCHFlo123 ปีที่แล้ว

    wouldn't it be better to use data-testIDs instead of simulating the scrolling behavior?

  • @robertcastillo8125
    @robertcastillo8125 ปีที่แล้ว

    How do we make it run multiple time?

  • @wotizit
    @wotizit 11 หลายเดือนก่อน

    Is there any alternative in puppeteer

  • @thewheeldeal8439
    @thewheeldeal8439 3 ปีที่แล้ว

    Great video, but I've a question about the run function. I've never seen a python function taking a dictionary-like argument (playwright: Playwright)
    What does it do? Also what does -> None do?

    • @Reese_414
      @Reese_414 2 ปีที่แล้ว

      Pandas has functions that take dictionary args, for renaming column headers. You pass a dict as an arg with the current header as a key & what you want it to be renamed as the value...

  • @liviud3d604
    @liviud3d604 ปีที่แล้ว +1

    This is so awesome, but in my case "playwright codegen" doesn't do anything and I have no idea why :(

    • @JohnWatsonRooney
      @JohnWatsonRooney  ปีที่แล้ว

      hmm not sure sorry, I've not had any issues before

    • @liviud3d604
      @liviud3d604 ปีที่แล้ว +1

      @@JohnWatsonRooney Thanks for your reply. It worked after a windows restart and your method also worked for the project im working on. You're a great teacher!

    • @JohnWatsonRooney
      @JohnWatsonRooney  ปีที่แล้ว

      @@liviud3d604 Great stuff! and thank you!

  • @KingShort8
    @KingShort8 ปีที่แล้ว

    How to not open codegen in incognito mode?

  • @shoebshaikh6310
    @shoebshaikh6310 3 ปีที่แล้ว +2

    Great 👍👍

  • @niklaschalupa8029
    @niklaschalupa8029 ปีที่แล้ว

    is this also working on react?

  • @notmiha1751
    @notmiha1751 3 ปีที่แล้ว +1

    Can we use proxy's ?

    • @JohnWatsonRooney
      @JohnWatsonRooney  3 ปีที่แล้ว +1

      Yes you can, the proxy goes within the browser launch command

  • @seoonlyRU
    @seoonlyRU 2 ปีที่แล้ว +1

    nice

  • @camuelcoleridge479
    @camuelcoleridge479 11 หลายเดือนก่อน

    Your head curve is like that or is it the hairs ?

    • @wotizit
      @wotizit 11 หลายเดือนก่อน

      They create

  • @jaimesandoval7435
    @jaimesandoval7435 8 หลายเดือนก่อน

    Awesome

  • @shadowkun-
    @shadowkun- 3 หลายเดือนก่อน

    Wtf this is amazing🥵

  • @dennistanui7085
    @dennistanui7085 3 ปีที่แล้ว +2

    RIP Selenium

    • @JohnWatsonRooney
      @JohnWatsonRooney  3 ปีที่แล้ว +4

      I certainly don’t think I’ll use it again

    • @rajeshn8533
      @rajeshn8533 6 หลายเดือนก่อน

      ​@@JohnWatsonRooneyso far, playwright exists as open source because of selenium.

  • @markcuello5
    @markcuello5 2 ปีที่แล้ว

    Help me

  • @billypool8453
    @billypool8453 ปีที่แล้ว

    3:53 pee stain