문제

Here's the javascript for the button I'd like to click using mechanize:

<form id="fLogin" method="post">
<input type="button" id="qLogin" name="qLogin" value="Login" onclick="return submitfunction();" class="qloginb" />

it's not recognize as clickable by mechanize. Here is the code for "submitfunction()":

function submitfunction()
{       

    var form = document.getElementById("fLogin");


    form.action = "/someurl/etc" + "&val1=" + val1.value + "&id1=" + id.Value;


    form.submit();
 }

Is there a way to 'simulate' clicking this button? From what I've read, it looks like doing something like this might work: "br.form.action="the wanted action" but I'm not sure how exactly to implement this approach. Any help would be appreciated.

도움이 되었습니까?

해결책

Was able to be logged in without using mechanize by constructing a URL from the form.action line and passing the login credentials in the query string:

http://www.example.com/someurl/etc?val1=somevalue&id1=someid&password=examplepassword&username=exampleusername

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top