Comments (2)
Here is the example in its entirety:
>>> from robobrowser import RoboBrowser
>>> browser = RoboBrowser()
>>> browser.open('http://russianlearn.com')
>>> form = browser.get_form(class_='searchformredbutton')
>>> form['sword'].value = 'cat'
>>> browser.submit_form(form)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/site-packages/robobrowser/browser.py", line 347, in submit_form
response = self.session.request(method, url, **send_args)
File "/usr/local/lib/python2.7/site-packages/requests/sessions.py", line 456, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python2.7/site-packages/requests/sessions.py", line 553, in send
adapter = self.get_adapter(url=request.url)
File "/usr/local/lib/python2.7/site-packages/requests/sessions.py", line 608, in get_adapter
raise InvalidSchema("No connection adapters were found for '%s'" % url)
requests.exceptions.InvalidSchema: No connection adapters were found for 'javascript:void(0)'
>>>
and the corresponding chunk of HTML:
<form class="searchformredbutton" style="margin-bottom:10px;margin-top:5px;" onsubmit="submitFormShadowbox();" action="javascript:void(0)" name="sForm">
<input class="keyboardInput" type="text" value="" maxlength="100" name="sword"></input>
<img class="keyboardInputInitiator" src="http://russianlearn.com/keyboard.png" alt="Virtual Keyboard Interface" title="Display virtual keyboard interface"></img>
<input class="submitred" type="submit" value=""></input>
</form>```
from robobrowser.
It looks like the form you're trying to submit uses javascript. Robobrowser doesn't evaluate javascript, so making this work will require a little extra work. It looks like submitting the form is supposed to send an ajax request to http://russianlearn.com/setvar.php. To make that work, you might try something like this:
form.action = 'http://russianlearn.com/setvar.php'
browser.submit_form(form)
Or, since the ajax request returns data and not HTML, you might want to use the browser's session
to make the request:
resp = browser.session.get('http://russianlearn.com/setvar.php', params={'value': 'cat'})
I'm going to close the issue, since working with javascript is beyond the scope of this library, but feel free to follow up if the suggestions above don't work for you. Thanks for reporting, and sorry for the very slow response!
from robobrowser.
Related Issues (20)
- cannot use
- .csv file getting record empty
- Unmaintained, dead, list of alternative projects
- Error handling detected unusual traffic
- browser cookies dont get changed HOT 1
- Import Error: HTMLParser HOT 1
- page screenshot
- Is this project abandonned ? HOT 1
- ImportError: cannot import name 'RoboBrowser' HOT 3
- Cannot set a value to non-existent attribute within a field
- Remove Checkbox in form
- Broken on Python 3.7 - access to re._pattern_type in Browser.get_link() HOT 1
- How to click a button in form HOT 2
- About retry
- Refresh page
- Inaccurate Docs
- RoboBrowser is broken with werkzeug upgrade HOT 4
- download
- pls fix the 'werkzeug' library HOT 8
- Possible to upload multiple files? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from robobrowser.