# 点击标签 browser.find_element_by_xpath("//a[@id='pc_"+str(i)+"']").click() x = browser.find_element_by_xpath("//a[@id='pc_"+str(i)+"']") # print x.text
# 点击‘加载更多内容’ browser.find_element_by_xpath("//a[@id='look-more']").click() time.sleep(2) browser.find_element_by_xpath("//a[@id='look-more']").click() time.sleep(2) for j in range(0, 40): title = browser.find_element_by_xpath("//a[@uigs='pc_"+str(i)+"_"+str(j)+"_title']") detail = browser.find_element_by_xpath("//a[@uigs='pc_"+str(i)+"_"+str(j)+"_title']/../..//p") s = x.text+' '+title.text+' '+detail.text print s