0

I'm able to make the xpath find work in all ways except reading in customers from a text file. I'm 98% sure it's a hidden character problem in the text file. What's the easiest way to take a column of names in an Excel file and save it as a file that can be read with this bit of code?

customerlist = open("customerlist.txt", "r")

customers = customerlist.readlines()

for customer in customers:
   
   datarow = driver.find_element_by_xpath("//span[contains(text(),'"+customer+"')]")

1 Answers1

1

Inserting this as the first item in the for loop did the trick

customer = customer.rstrip("\n")