Navigation

    OpenIAP

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    Challenge scraping values from a table

    General Discussion
    scraping selectors
    3
    5
    57
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R
      rjvanschoonhoven last edited by Allan Zimmermann

      Hi,

      I have puzzle (or a challenge) that I can't seem to fix...

      I want to scrape data from a website.
      I am interested in the values of 2 columns (out of 20) and there is a variable number of rows (between 20 and 4000).

      vessel_eta_list.jpg

      The full X-paths of the 2 values of the first row are:

      /html/body/form/div[4]/table/tbody/tr/td[1]/table/tbody/tr/td/div/div/div[2]/div[2]/div[6]/div[1]/table/tbody/tr[2]/td[7]
      /html/body/form/div[4]/table/tbody/tr/td[1]/table/tbody/tr/td/div/div/div[2]/div[2]/div[6]/div[1]/table/tbody/tr[2]/td[11]
      

      So tr[1] is the table header.
      And td[7] and td[11] contain the values of interest of each row.

      I tried a while loop with a counter, but I don't know how to insert the counter value in the tr[counter] line and then use it in the selector.

      What would be a good approach for this?

      Kind regards,

      Rutger van Schoonhoven

      Flávio Pinheiro de Souza Allan Zimmermann 2 Replies Last reply Reply Quote 0
      • Flávio Pinheiro de Souza
        Flávio Pinheiro de Souza @rjvanschoonhoven last edited by

        Hi, @rjvanschoonhoven

        take a look at this video and see if it helps.
        https://www.youtube.com/watch?v=bPC85GSAicQ&ab_channel=AllanZimmermann

        Allan Zimmermann 1 Reply Last reply Reply Quote 0
        • Allan Zimmermann
          Allan Zimmermann @rjvanschoonhoven last edited by

          Hey
          The prefered way of scraping a table of data is to add a Get Element that gets each row ( TR ) and then add 1 or more Get Elements inside the first Get Element to select the desired element, per row ( TD )
          Here is a small example:
          https://www.youtube.com/watch?v=rDj2VUjE0so&vq=hd1440

          1 Reply Last reply Reply Quote 1
          • Allan Zimmermann
            Allan Zimmermann @Flávio Pinheiro de Souza last edited by

            @flávio-pinheiro-de-souza This only works for windows components using standard data tables, it will not work for all types of tables, and does not work for other technologies, like Java, IE and NM/chrome, but good thinking 🙂 .. I should definitely try and add better scraping options soon.

            R 1 Reply Last reply Reply Quote 0
            • R
              rjvanschoonhoven @Allan Zimmermann last edited by

              @allan-zimmermann
              @flávio-pinheiro-de-souza
              Thanks for your reply! It looked exactly like what I needed, but I didn't get it to work on my particular table.

              @Allan-Zimmermann,
              Thanks again! It works like a charm.
              This is really cool stuff.

              Kind regards,

              Rutger van Schoonhoven

              1 Reply Last reply Reply Quote 0
              • First post
                Last post