打印Python中的元素列表

时间:2017-11-26 21:10:54

标签: python arrays xpath

我得到了以下元素列表:

//*[@id="easPanelGrid_item_0"]/td[3], //*[@id="easPanelGrid_item_1"]/td[3], //*[@id="easPanelGrid_item_2"]/td[3], etc.

我需要打印它们。到目前为止,这是我的代码:

try:
    for i in range(1, 23):
        name = self.driver.find_element_by_xpath('//*[@id="easPanelGrid_item_[%d]"]/td[3]' % (i)).text
        print(name)
伙计们,谢谢你,现在一切都好。解决方案:

        try:
            for i in range(1, 23):
                name = self.driver.find_element_by_xpath('//*[@id="easPanelGrid_item_%d"]/td[3]' % (i))
                print(name.text)

0 个答案:

没有答案
相关问题