2

I have an excel sheet with data I'd like to input into boxes on a web form.

import pandas as pd
df = pd.read_excel('C:\\Users\\jj\\Documents\\python_date_test.xlsx', Sheet_name=0)
(df['bx1'][0])

The output of the above code is '2'

When I insert this code into the code I'm using to webcrawl, I get the following error 'TypeError: object of type 'numpy.int64' has no len()'

Here's the code that produced this error:

mea1 = browser.find_element_by_name("data1_14581")
mea1.click()
mea1.send_keys((df['bx1'][0]))
mea1.send_keys(Keys.TAB)

mea1 refers to the first box for user input.

How can I get the value of (df['bx1'][0]) and enter it in to the box?

3
  • It's probably not related to the issue, but you should access the element using df.loc[0, "bx1"] instead of df['bx1'][0]. Commented Feb 21, 2020 at 23:29
  • I can't reproduce your error, it works for me. Pass it to a variable first then try it again Commented Feb 21, 2020 at 23:52
  • convert to string, str(....) Commented Feb 21, 2020 at 23:58

1 Answer 1

1

I haven't used this package but looking at it I believe you are on the right track, try changing the code to:

mea1.send_keys(str((df['bx1'][0])))
Sign up to request clarification or add additional context in comments.

1 Comment

Welcome to StackOverflow @pete-breslin, 1+ for your answer!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.