The_Diver
The_Diver

Reputation: 1915

Selenium- len of text returns zero?

I want to get the len of a text field after calling .send_keys() method on and entering texts in.Although that after calling the method there are texts, the following len statement returns zero:

print len(driver.find_element_by_id('some id').text)

returns zero.

Is there anyway to overcome this problem and get the len of the field after having texts entered?

Upvotes: 0

Views: 281

Answers (1)

Mahsum Akbas
Mahsum Akbas

Reputation: 1583

To take a text in a input area(textfield), you should get value of attribute.

print len(driver.find_element_by_id("textbox").get_attribute("value"))

Upvotes: 2

Related Questions