Note that there are some explanatory texts on larger screens.

plurals
  1. POpython mechanize javascript submit button problem!
    primarykey
    data
    text
    <p>im making some script with mechanize.browser module.</p> <p>one of problem is all other thing is ok, but when submit() form,it not working,</p> <p>so i was found some suspicion source part.</p> <p>in the html source i was found such like following.</p> <p></p> <p>im thinking, loginCheck(this) making problem when submit form.</p> <p>but how to handle this kind of javascript function with mechanize module ,so i can</p> <p>successfully submit form and can receive result?</p> <p>following is websource snippet which related with loginCheck(this) javascript function.</p> <pre><code> function init(){ FRMLOGIN.ID.focus(); } function loginCheck(f){ if(chkNull(f.ID, "아이디를")) return false; if(chkNull(f.PWD, "패스워드를")) return false; //f.target = "ifrmLoginHidden"; f.action = (f.SECCHK.checked) ? "https://user.buddybuddy.co.kr/Login/Login.asp" : "http://user.buddybuddy.co.kr/Login/Login.asp"; } </code></pre> <p>i know mechanize not support javascript, so i want to make progammatically loginCheck() </p> <p>function with python mechanize code.</p> <p>anyone would you some help me to make this javascript function to python mechanize </p> <p>translated code?</p> <p>so correctly can login with website?</p> <p>if so much appreciate!</p> <pre><code> # -*- coding: cp949-*- import sys,os import mechanize, urllib import cookielib from BeautifulSoup import BeautifulSoup,BeautifulStoneSoup,Tag import datetime, time, socket import re,sys,os,mechanize,urllib,time br = mechanize.Browser() cj = cookielib.LWPCookieJar() br.set_cookiejar(cj) # Browser options br.set_handle_equiv(True) br.set_handle_gzip(True) br.set_handle_redirect(True) br.set_handle_referer(True) br.set_handle_robots(False) # Follows refresh 0 but not hangs on refresh &gt; 0 br.set_handle_refresh(mechanize._http.HTTPRefreshProcessor(), max_time=1) # Want debugging messages? br.set_debug_http(True) br.set_debug_redirects(True) br.set_debug_responses(True) # User-Agent (this is cheating, ok?) br.addheaders = [('User-agent', 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.6')] br.open('http://user.buddybuddy.co.kr/Login/LoginForm.asp?URL=') html = br.response().read() print html br.select_form(name='FRMLOGIN') print br.viewing_html() br.form['ID']='psh7943' br.form['PWD']='qkrthgus' br.submit() print br.response().read() </code></pre> <p>if anyone can help me ..much appreciate!!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload