THIS is Playwrights BEST Feature for Web Automation

Поделиться
HTML-код
  • Опубликовано: 15 дек 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 3 года назад +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.

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

  • @adnanpramudio6109
    @adnanpramudio6109 3 года назад +1

    Thanks john for covering about scroll down and up

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

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

  • @lostfsoul
    @lostfsoul 3 года назад +2

    Like always John great content !

  • @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 11 месяцев назад

      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🙂

  • @michaeldacosta7504
    @michaeldacosta7504 3 года назад +1

    Very fancy. Thanks for the video!

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

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

  • @lowkeylyesmith
    @lowkeylyesmith Год назад +1

    thumbs up and subscribed, thank you for your videos

  • @AleemAhmed-g3n
    @AleemAhmed-g3n Год назад

    Nice. Didn't knew playwright had that feature!

  • @vikramgupta5958
    @vikramgupta5958 Год назад

    How can we generate code for device like iphone

  • @narutocole
    @narutocole 3 года назад +2

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

  • @MrTASGER
    @MrTASGER 3 года назад

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

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

  • @KingShort8
    @KingShort8 Год назад

    How to not open codegen in incognito mode?

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

  • @dand4485
    @dand4485 2 года назад +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  2 года назад

      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 2 года назад +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 :)

  • @FCHFlo123
    @FCHFlo123 Год назад

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

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

  • @jimmedlock6004
    @jimmedlock6004 10 месяцев назад

    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?

  • @amitwali6844
    @amitwali6844 2 года назад

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

  • @robertcastillo8125
    @robertcastillo8125 Год назад

    How do we make it run multiple time?

  • @CodePhiles
    @CodePhiles 3 года назад +1

    brilliant, Thanks for sharing this video

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

  • @wotizit
    @wotizit 11 месяцев назад

    Is there any alternative in puppeteer

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

  • @niklaschalupa8029
    @niklaschalupa8029 Год назад

    is this also working on react?

  • @inakisehernandez5220
    @inakisehernandez5220 2 года назад

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

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

  • @tubelessHuma
    @tubelessHuma 3 года назад +1

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

  • @Explore4code
    @Explore4code 8 месяцев назад

    So powerful. I really appreciate it 🙏🏼🙏🏼

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

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

  • @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 3 года назад

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

  • @camuelcoleridge479
    @camuelcoleridge479 Год назад

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

    • @wotizit
      @wotizit 11 месяцев назад

      They create

  • @notmiha1751
    @notmiha1751 3 года назад +1

    Can we use proxy's ?

    • @JohnWatsonRooney
      @JohnWatsonRooney  3 года назад +1

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

  • @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 RUclips user.

  • @_elkd
    @_elkd 2 года назад +2

    Wow

  • @mihaissv9469
    @mihaissv9469 Год назад +1

    lovely!

  • @shoebshaikh6310
    @shoebshaikh6310 3 года назад +2

    Great 👍👍

  • @seoonlyRU
    @seoonlyRU 3 года назад +1

    nice

  • @dennistanui7085
    @dennistanui7085 3 года назад +2

    RIP Selenium

    • @JohnWatsonRooney
      @JohnWatsonRooney  3 года назад +4

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

    • @rajeshn8533
      @rajeshn8533 7 месяцев назад

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

  • @markcuello5
    @markcuello5 2 года назад

    Help me

  • @jaimesandoval7435
    @jaimesandoval7435 9 месяцев назад

    Awesome

  • @shadowkun-
    @shadowkun- 4 месяца назад

    Wtf this is amazing🥵

  • @billypool8453
    @billypool8453 Год назад

    3:53 pee stain