如何为Selenium/Python创建一个文本文件,以便在没有额外字符问题的情况下读取
除了从文本文件读入客户之外,我能够使xpath find在所有方面都有效。我98%确定这是文本文件中的隐藏字符问题。在Excel文件中获取一列名称并将其保存为可使用此代码读取的文件的最简单方法是什么如何为Selenium/Python创建一个文本文件,以便在没有额外字符问题的情况下读取,python,selenium,Python,Selenium,除了从文本文件读入客户之外,我能够使xpath find在所有方面都有效。我98%确定这是文本文件中的隐藏字符问题。在Excel文件中获取一列名称并将其保存为可使用此代码读取的文件的最简单方法是什么 customerlist = open("customerlist.txt", "r") customers = customerlist.readlines() for customer in customers: datarow = dr
customerlist = open("customerlist.txt", "r")
customers = customerlist.readlines()
for customer in customers:
datarow = driver.find_element_by_xpath("//span[contains(text(),'"+customer+"')]")
将此项作为for循环中的第一项插入就成功了 customer=customer.rstrip(“\n”)也许这会对您有所帮助-