driver.find_element_by_xpath('//div[text()="variable"]')
其中变量包含随机文本.使用sql就像这样(select * from table where value =(?)),[variable] …或类似的东西
driver.find_element_by_xpath('//div[text()="%s"]' % variable)