TagUI tutorial 1 - goodreads.com - Part 1

Problem

Take a look at the website: https://www.goodreads.com/list/show/118408.New_York_Times_2017_Ten_Best

We want to grab the title of the list "New York Times 2017 Ten Best" as indicated by the red arrow below:

tutorial-01

Solution

//goodreads_v01
https://www.goodreads.com/list/show/118408.New_York_Times_2017_Ten_Best
read //h1[@class="gr-h1 gr-h1--serif"] to title
echo "title = " + title

Explanation

Line 1: The double slash // in TagUI denotes comments
Line 2: Go to the website: https://www.goodreads.com/list/show/118408.New_York_Times_2017_Ten_Best
Line 3: read the list title to the variable title
  • In Chrome browser, right click on the title and choose "Inspect". The Chrome Developer Tools will be displayed and you will see that the HTML of the title is:
  • <h1 class="gr-h1 gr-h1--serif">New York Times 2017 Ten Best</h1>
  • Hence we use the following XPath to get the title:
    //h1[@class="gr-h1 gr-h1--serif"]

    Note: if you are new to XPath, please refer to the XPath Tutorial.

  • The value read is stored in the variable title.
Line 4: Output the title to the command window using the echo command

Other TagUI Tutorials

Other Resources

Comments (0)

There are no comments posted here yet

Leave your comments

Posting comment as a guest. Sign up or login to your account.
Attachments (0 / 3)
Share Your Location