S
S
soremix2016-08-26 15:33:09
Python
soremix, 2016-08-26 15:33:09

Can't submit form via Python Grab?

Hello again. You need to log in to the mrandom website.
When you click on the "Login" button, it redirects to mrandom.com/auth/vk, which in turn goes to https://oauth.vk.com/authorize?response_type=code&...
Here is the form itself : Field names
1df690d0e963487ebb8d59e8eb8dbe10.png
- email, pass . There is this code:

from grab import Grab
import pycurl
import time

g = Grab()

g.go('https://oauth.vk.com/authorize?response_type=code&redirect_uri=http%3A%2F%2Fmrandom.com%2Fauth%2Fvk%2Fcallback&scope=friends%2Coffline%2Cemail%2Cwall%2Cgroups&client_id=4403271')
time.sleep(2)
g.set_input('email', '[email protected]')
g.set_input('pass', 'YYYYYYYYYY')
g.doc.submit('install_allow')

Throws an error:
"weblib.error.DataNotFound: Could not get first item for .//*[@name="email"] query of class XpathSelector"
What's wrong? After all, the name of the fields is clearly correct

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Minary, 2016-08-26
@Minary

Try like this

g.set_input('input[@name="email"]', '*******')
g.set_input('input[@name="pass"]', '******')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question