open links in a html page

Ajar ajartaknev at gmail.com
Tue Aug 16 16:52:05 CEST 2005


Hi,

Using urllib2,ClinetForm and ClinetCookie modules I have logged into my
ISPs web site and managed to fetch the first page. Now, on this page
there is this link:

<a href="#"  onclick="check(4);return false;" class="zi01">Service
Records</a>

I need to click this link from python code. How do I do it? check(4) is
the following javascript function:

-------------------------------------------------------------------------------

function check(parameter){
        if(parameter==1){
            parent.frames(0).location.href="userinfo.jsp" + "?" + new
Date().toString();
        }else if(parameter==2){
            parent.frames(0).location.href="modipswd.jsp" + "?" + new
Date().toString();
        }else if(parameter==3){
             parent.frames(0).location.href="cardrecharge.jsp" + "?" +
new Date().toString();
        }else if(parameter==4){
            parent.frames(0).location.href="serviceRecords.jsp" + "?" +
new Date().toString();
        }else if(parameter==5){
             parent.frames(0).location.href="rateSelectResult.jsp" +
"?" + new Date().toString();
        }
        else if(parameter==6){
             parent.frames(0).location.href="stopService.jsp" + "?" +
new Date().toString();
        }
        else if(parameter==7){
             if (confirm("Are you sure to exit?")){
                window.location="../logout.jsp";
                return true;
             }else{
                return false;
             }
        }else if(parameter==8){
             parent.frames(0).location.href="cancelService.jsp" + "?" +
new Date().toString();
        }else{
             return false;
        }




More information about the Python-list mailing list