Thing I want to do

I would like to extract the following two with the code below.

  • Text of a tag with li 1
  • Text of a tag with li 2
def test (driver):
    for number in range (1, 3):
        xpath_of_target ='// * [@ id = "list"]/li ["'+ str (number) +'"]/a'
        element = driver.find_element_by_xpath (xpath_of_target)
        filename = driver.find_element_by_xpath (xpath_of_target) .text
        print (filename)
What's happening

I'm looping with a for statement, but both filenames have a li of 1.

Contents of question
  1. When I try to debug, it seems that I can not overwrite the function in the for statement,
    Is it as you recognize?
  2. In this case, how can I code the following two texts?