def split_xpath(xpath):
  """Gets a list of html tags from a xpath string."""
  # Example:
  # "/div[1]/span[2]/br[1]" --> ["div", "span", "br"]
  # "/div[1]/span[2]/tail" --> ["div", "span", "tail"]
  # "/div[1]/span[2]/a" --> ["div", "span", "a"]
  split_tags = []
  for tag in xpath.split("/"):
    if tag.find("[") >= 0:
      tag = tag[:tag.find("[")]
    if tag.strip():
      split_tags.append(tag.strip())
  return split_tags