I want to pull the length of an input that is entered into a website's text box to see the max amount of characters that it will allow. The HTML says that the max length is 40 so I am trying to enter 41 characters to see if it will only take the first 40 characters entered. When I run the code that I have, I get AttributeError: 'NoneType' object has no attribute 'get_attribute'
This is my code so far:
def test_FN_SPmax(self):
time.sleep(3)
first_name = self.driver.find_element_by_xpath(
'/html/body/div[4]/div[1]/section/div[2]/div[1]/div[4]/div/div/div/div/div/div[2]/div/div[1]/section/div/section/div/div/div/div/div/div[1]/div/div/div/fieldset/div/div[2]/input').send_keys(
''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(41)))
time.sleep(2)
typedValue = first_name.get_attribute('value')
size = typedValue.length()
print(size)