Home > other >  [] primary problem in python to use for reaching after traversal xpath, each output data results are
[] primary problem in python to use for reaching after traversal xpath, each output data results are

Time:03-07

The from the selenium import webdriver
The import time

Browser=webdriver. Chrome ()
The get (" http://f10.eastmoney.com/f10_v2/FinanceAnalysis.aspx? Code=sz300415 ")
The find_element_by_xpath ('.//HTML/body/div [1]/div [2]/div [4]/div [3]/ul/li [2] '). Click ()
Time. Sleep (5)

List=[]
For I in range (2, 7) :
var=the find_element_by_xpath ("/HTML/body/div [1]/div [2]/div [4]/div [4]/div/table/tbody tr [10]/td [' I ']/span "). The text
List. Append (var)
# var2=the find_element_by_xpath ('/HTML/body/div [1]/div [2]/div [4]/div [4]/div/table/tbody tr [10] [3]/td/span '). The text
# var3=the find_element_by_xpath ('/HTML/body/div [1]/div [2]/div [4]/div [4]/div/table/tbody tr [4] [10]/td/span '). The text
# var4=the find_element_by_xpath ('/HTML/body/div [1]/div [2]/div [4]/div [4]/div/table/tbody tr [10] [5]/td/span '). The text
# var5=the find_element_by_xpath ('/HTML/body/div [1]/div [2]/div [4]/div [4]/div/table/tbody tr [10] [6]/td/span '). The text
The close ()
Print (list)

The results from the
[' operating income (yuan) ', 'operating income (yuan)', 'operating income (yuan)', 'operating income (yuan)', 'operating income (yuan)]
And the result is I=1 when the text of.
O teach thank you
  • Related