I want to automate a process that searches for a key word in a search bar using Python on my server. However, searching first returns a disclaimer and once accepted, the result is actually shown. The disclaimer site is the following:
http://emma.msrb.org/Disclaimer.aspx
I have already inspected the website and this is my preliminary code:
browser = RoboBrowser(history=True)
browser.open(tradeinfo)
# tradeinfo = link to search result, i.e. http://emma.msrb.org/SecurityDetails/TradeActivity/ABF6AA894523779EDC8B751EB99959934
form = browser.get_forms()[0]
print form
<RoboForm __VIEWSTATE=somevalue, __VIEWSTATEGENERATOR=somevalue, __EVENTVALIDATION=somevalue,
ctl00$Masthead$UserAcct1$NextAction=,
ctl00$Masthead$UserAcct1$isPilotUser=False, ctl00$Masthead$searchTextBox=Enter CUSIP or Name,
ctl00$Masthead$headerSearchButton=,
ctl00$mainContentArea$disclaimerContent$yesButton=,
ctl00$mainContentArea$disclaimerContent$noButton=>
# Somevalue represents a string of characters (deleted for visual clarity)
Then I do the following:
form['ctl00$mainContentArea$disclaimerContent$yesButton'].value ='Yes'
browser.submit_form(form)
browser.select('body')
But the body still doesn't contain the data. I also tried mechanize, with the same outcome. Is there a way to do this without Selenium, using just mechanize or RoboBrowser? If so, what I am I missing in my script?
P.S: html script for the "Accept" button:
<input type="image"
name="ctl00$mainContentArea$disclaimerContent$yesButton"
id="ctl00_mainContentArea_disclaimerContent_yesButton"
data-jquerymobilestyle="false"
src="images/btnAccept.gif" alt="Accept" style="border-width:0px;">