0

I'm trying to use a combination of Python, PyQuery and Paste to submit a javacript from in a web page.

I know a bit of Python, but I'm really new to javascript.

What I tried was the following:

from pyquery import PyQuery as pq
import urllib
d = pq(url='http://www.optimustag.pt/'
f = d("#login-form")
f.attr["login-user"] = "somename"
f.attr["login-pass"] = "somepass"

But I stop here, I can't find anyway of submitting this form.

If I do a: print f, I get:

<form id="login-form" action="javascript:doLogin();">
                <input id="login-user" type="text" style="border: 0px solid #fff;width:120px; &#10;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;height:20px; font-family:Arial;font-size:14px;&#10;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;position:absolute;top:43px;left:17px;" value=""/><input id="login-pass" type="password" style="border: 0px solid #fff;width:120px; &#10;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;height:20px; font-family:Arial;font-size:14px;&#10;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;position:absolute; top:43px; left:154px;" value=""/><input id="login-remember" type="checkbox" style="position:absolute;top:73px;left:20px; &#10;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;border: 0px solid #fff;"/><a href="javascript:Registration.recover();" style="position:absolute;top: 75px; left: 151px; &#10;&#9;&#9;&#9;&#9;&#9;&#9;&#9;font-family:Arial;font-size:11px;font-decoration:underline;&#10;&#9;&#9;&#9;&#9;&#9;&#9;&#9;color:#000;width:80px; height:15px;"/>
                <input type="image" value="" id="login_enter_submit" src="css/blank.gif"/></form>

This is my form.

Of course that if there is some way to do this in Python without PyQuery it would be ok as well.

jbssm
  • 6,861
  • 13
  • 54
  • 81

1 Answers1

0

There is no way to do that. PyQuery has no js emulator.

gawel
  • 2,038
  • 14
  • 16
  • Is there any other way to do it? By using Paste with PyQuery for instance, since I got the idea I could use AJAX scripts inside Python that way. – jbssm Mar 27 '12 at 16:27