beautifulsoup - Python robobrowser get_form isn't getting the whole form -
i using robobrowser automate search on website. need fill in 2 form inputs robobrowser.get_form picking first input. ideas on how full form , assign value second input?
html:
<form name="form1" method=post action="/sundown/cart_prod/cart_con_r2trastrep2"> <h5 align= "center"><font face_"verdana,arial, helvetica, sans-serif" size="4">enter report date(mm/yyyy): <input type="text" name="p_r2reportdate" size="6" maxlength="7"> </font></p> <h5 align= "center"><font face_"verdana,arial, helvetica, sans-serif" size="4">enter transporter id: <input type="text" name="p_r2trans_id" size="6" maxlength="7"> </font></p> <input type="submit" > </font></p> </form>
python script:
import re robobrowser import robobrowser sonris = 'http://sonlite.dnr.state.la.us/sundown/cart_prod/cart_con_r2trastrep1' former1 = "p_r2reportdate" former2 = "p_r2trans_id" date = '01/2016' code = '7250' #capline browser = robobrowser(history=true,parser='html.parser') browser.open(sonris) form = browser.get_form(action="/sundown/cart_prod/cart_con_r2trastrep2") print(form) #<roboform p_r2reportdate=> form[former1].value = date form[former2].value = code browser.submit_form(form) print(str(browser.parsed))
the reason can see if second parameter has name attribute in lower case "name" opposed "name" earlier. suggest if can fix source else input field form using attribute , set value.
Comments
Post a Comment