0

I am trying to login to a webpage which uses javascript to login. the page contains a file called "login.js" ad it has following method:

function onformSbumit(object, e){
  if (e.getKey() === 13 || object.xtype==='button') {
    var form = object.up('form').getForm();
    if(form.isValid()) {
      form.submit({
        method : 'POST',
        success : function(form, action) {
          var result = Ext.decode(action.response.responseText);
          Ext.util.Cookies.set("userName", result.data.principal.userId);
          Ext.util.Cookies.set("id", result.data.principal.id);
          Ext.util.Cookies.set("role", result.data.principal.role);
          Ext.util.Cookies.set("roleName", result.data.principal.roleObj.roleName);
          Ext.util.Cookies.set("privilege", result.data.principal.roleObj.rolePrivileges);
          Ext.util.Cookies.set("partitionid", result.data.principal.operatorId);
          Ext.util.Cookies.set("partitionName", result.data.principal.operator.name);
          Ext.util.Cookies.set("time", result.data.principal.time);
          Ext.util.Cookies.set("timeZone", result.data.principal.timeZone);
          var redirect = 'main';
          window.location = redirect;
        }
      })
    }
  }
}

I want to know which procedure has to be followed for login to this page.

1 Answer 1

1

There are 2 options in my opinion:

  • use the python module requests in order to perform the POST request.
  • use selenium in order to simulate browser activity.

For more information: requests or selenium.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.