I am trying to send keys on search bar from a column in a excel, it works fine previously but now it just return errors: object of type 'float' has no len().
Please find the code:
def search(key):
driver.get(url)
driver.find_element_by_xpath('//*[@id="searchCode"]').clear()
driver.implicitly_wait(10)
driver.find_element_by_xpath('//*[@id="searchCode"]').send_keys(key)
def get_keyword():
data = pd.read_excel('search.xlsx')
for d in data['code']:
search(d)
If I change to:
def search(key):
driver.get(url)
driver.find_element_by_xpath('//*[@id="searchCode"]').clear()
driver.implicitly_wait(10)
driver.find_element_by_xpath('//*[@id="searchCode"]').send_keys(str(key))
def get_keyword():
data = pd.read_excel('search.xlsx')
for d in data['code']:
search(d)
Then the search bar appears: 175717.0, but in excel, it is only 175717 and test format, it is a bit confusing...
Excel:(pretty sure no float value, and I convert to text format already
code
175717
175740
Could someone please help with this, thanks!