Skip to content

Tabular Troubles Problem


Different dogs come from different places! Corporate just tasked us with retrieving a sorted list of the breeds they are interested in from here. There is a table under the second tab, which we need to sort by country (in ascending order), and then extract all data from. Automate the following:

  1. Go to the page about dog breeds.
  2. Click on the second tab (Table of Different Dog Breeds).
  3. Click the column header for Country of Origin until the column is ascending.
  4. Read out all the table data and write it into a nested Python list.

Starter code

from selenium import webdriver

driver = webdriver.Chrome()
driver.get("https://seleniumplayground.practiceprobs.com/dogs/breeds/")
driver.implicitly_wait(5)
# Your Code here
Expected Result
table_data = [
    [
    '<a href="akita/">Akita Inu</a>',
    'Large breed of dog from northern Japan',
    '<a href="https://en.wikipedia.org/wiki/Akita_(dog)">Wiki: Akita Inu</a>',
    '<img alt="๐Ÿ‡ฏ๐Ÿ‡ต" class="twemoji" src="https://twemoji.maxcdn.com/v/latest/svg/1f1ef-1f1f5.svg" title=":flag_jp:">'
    ],
    [
    '<a href="labrador_retriever/">Labrador Retriever</a>',
    'British breed of retriever gun dog',
    '<a href="https://en.wikipedia.org/wiki/Labrador_Retriever">Wiki: Labrador Retriever</a>',
    '<img alt="๐Ÿ‡ฌ๐Ÿ‡ง" class="twemoji" src="https://twemoji.maxcdn.com/v/latest/svg/1f1ec-1f1e7.svg" title=":flag_gb:">'
    ],
    [
    '<a href="german_shepherd/">German Shepherd</a>',
    'German breed of working dog of medium to large size',
    '<a href="https://en.wikipedia.org/wiki/German_Shepherd">Wiki: German Shepherd</a>',
    '<img alt="๐Ÿ‡ฉ๐Ÿ‡ช" class="twemoji" src="https://twemoji.maxcdn.com/v/latest/svg/1f1e9-1f1ea.svg" title=":flag_de:">'
    ]
]