I have been attempting to use BS to find the value of an input field on a webpage. However, no matter what I try, it always returns as 'None' although the element certainly exists. Here is a sample of the HTML.
<td class="formArea"><table border="0" cellspacing="2" cellpadding="2">
<tr>
<td class="main">Street Address:</td>
<td class="main">
<input type="text" name="entry_street_address" id="entry_street_address" value="1234 Example Ln" maxlength="64" required> <span class="fieldRequired">* Required</span></td>
So I attempt to use BS4 to grab the value of 'entry_street_address':
r = session.get("sampleurl.com/wheremydataisstored")
time.sleep(3)
soup = bs4(r.content,'html5lib')
info = soup.find('input', {'id': 'entry_street_address'}).get('value')
print(info)
Unfortunately, this always returns:
AttributeError: 'NoneType' object has no attribute 'get'
This always happens. No matter if I do html5lib, lxml, html.parser, no matter how long I .sleep() to wait for the page to load, etc. I'm not really sure where it's going wrong!