0

I'm trying to insert text into a text box. When I inspect the textbox I found out that their are no identifiers for the text box so I used the xpath.

On inspecting the textbox

textbox = driver.find_elements_by_xpath("/html/body/main/article/div/div/div[3]/div/div[1]/div/div/form/div[1]/div/div/div/div[1]/textarea")
textbox.click()
textbox.send_keys("convert")

But it throws an error

"AttributeError: 'list' object has no attribute 'click'".

I tried to find out where the text gets written and it is written in Code-line class. Code gets written here

I don't understand what's actually going on here because I have not seen any textbox which don't have any identifier.

How can I identify the textbox and insert text into it?

1 Answer 1

1

You should use driver.find_element_by_xpath instead of driver.find_elements_by_xpath

driver.find_element_by_xpath returns single webelement so you can perform the action like click or sendkeys

driver.find_elements_by_xpath returns list of webelement So you need to iterate the list to extract the webelement one by one

Sign up to request clarification or add additional context in comments.

1 Comment

When I do that It throws another exception. selenium.common.exceptions.ElementNotInteractableException: Message: Element <textarea> could not be scrolled into view

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.