Skip to content Skip to sidebar Skip to footer

Python Selenium Print Out Value Of Textfield Is Showing Empty. The Value Is Not Printing

I am trying to print out the value of a textfield to the console. The webpage has the value 1,000.000 in the textfield. 1,000.000 should be printed but my method is printing blank

Solution 1:

Actually try getting the value instead of text.

from selenium.webdriver.common.by import By

# max records textfield has the value 1,000.000 as default
def print_maxrecords_textfield(self):
    max_records_textfield = self.driver.find_element((By.XPATH, '//span[@class="gwt-InlineLabel myinlineblock marginbelow" and contains(text(), "Max records")]/following-sibling::*'))
    print "max_records_textfield = "
    print max_records_textfield.get_attribute('value')

Post a Comment for "Python Selenium Print Out Value Of Textfield Is Showing Empty. The Value Is Not Printing"