Getting a list of list elements using Playwright

I am trying to write an application where it will go to amazon and get a list of books on the page. I am using Playwright as the tool. I can get to the right section but I can’t get the list of books. Looking online the examples seem to use page.$$(selector) but when I try that, I get an empty array back. Found this information here and here. Reading the docs on $$, this seems like the right call as all the list elements have the same class name. I have no idea what I am doing wrong, any advice on this?

Here is my code so far;

(async () => {
    const browser = await chromium.launch();
    try {
        const amazonPage = await browser.newPage();
        await amazonPage.goto(AMAZON_KINDLE_EBOOK_STORE_URL);

        await amazonPage.waitForSelector('"Best Sellers in"');

        const books = await amazonPage.$$('li[class="zg-item-immersion"]');
    } finally {
        await browser.close();

For the selector I have tried it numerous ways as well;

  • li[class="zg-item-immersion"] – This actually worked checking on the dev console
  • 'zg-item-immersion'
  • #zg-item-immersion

124 thoughts on “Getting a list of list elements using Playwright”

  1. Pingback: generic viagra
  2. Pingback: viagra online usa
  3. Pingback: herbal viagra
  4. Pingback: sildenafil online
  5. Pingback: cialis price
  6. Pingback: canadian viagra
  7. Pingback: cheap viagra
  8. Pingback: generic for viagra
  9. Pingback: sildenafil 50 mg
  10. Pingback: tab cialis 20mg
  11. Pingback: buy generic viagra
  12. Pingback: 20mg cialis daily
  13. Pingback: how to get viagra
  14. Pingback: sildenafil 50mg
  15. Pingback: viagra sale
  16. Pingback: order viagra
  17. Pingback: viagra use
  18. Pingback: viagra ohne rezept
  19. Pingback: levitra vs viagra
  20. Pingback: viagra pill
  21. Pingback: buy viagra online
  22. Pingback: online viagra
  23. Pingback: viagra dosages
  24. Pingback: viagra dosage
  25. Pingback: viagra en ligne
  26. Pingback: viagra or cialis
  27. Pingback: hims viagra
  28. Pingback: female viagra pill
  29. Pingback: goodrx sildenafil
  30. Pingback: cialis best price