【问题标题】:How do I modify a .html file to give hardcoded inputs to input fields every time?如何修改 .html 文件以每次为输入字段提供硬编码输入?
【发布时间】:2013-05-06 21:43:27
【问题描述】:

我想访问我的 Powerschool (powerschool.avon.k12.ct.us),我发现每次都需要输入我的密码和用户名相当乏味。为了尝试解决这个问题,我在 Chrome 中下载了该页面的源代码,如下所示:

<!DOCTYPE html>
<!-- saved from url=(0052)http://powerschool.avon.k12.ct.us/guardian/home.html -->
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>Parent Sign In</title>
<meta http-equiv="X-UA-Compatible" content="IE=8">
<meta name="robots" content="noindex">
<link href="./Powerschool_files/screen.css" rel="stylesheet" type="text/css" media="screen">

<meta name="viewport" content="width=device-width">
<script src="./Powerschool_files/jquery-1.4.2.min.js"></script><style type="text/css"></style> 
<script language="JavaScript" src="./Powerschool_files/md5.js" type="text/javascript"></script>
<script language="JavaScript" type="text/javascript"><!--
var pskey = "4EDE156E2FAD0F1A427D2AD066530F496ADC3EEA78CE43E70F28053576FD4EA1";
//-->
</script>
<script language="JavaScript" type="text/javascript">
function deleteCookie(cookieName){
    var cookieDate = new Date();
    cookieDate.setTime(cookieDate.getTime()-1);
    document.cookie = cookieName + "=; expires='" + cookieDate.toGMTString()+"'; path=/";
}
deleteCookie("InformAuthToken");

function getURLParameter(name) {
    return unescape(
        (RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1]
    );
}

var $j = jQuery.noConflict();
$j(document).ready(function() {
    // Hide or show the translator login input field
    // if the URL parameter "translator" is present
    var translator = getURLParameter("translator");
    if (translator == "null") {
        $j('#translatorInput').hide();
    } else {
        if (translator == "true") {
            $j('#translatorInput').show();
        } else {
            $j('#translatorInput').hide();
        }
    }
    $j('a.popWin').click(function(){
        var winURL = $j(this).attr('href');
        window.open(winURL);
        return false;
    });
});
</script>
</head>
<body class="pslogin" id="palogin">
<div id="container">
     <div id="branding-powerschool"><img src="./Powerschool_files/ps7-logo-lrg.png" alt="PowerSchool" width="280" height="41"></div>
  <div id="content" class="group">
<form action="./Powerschool_files/Powerschool.htm" method="post" name="LoginForm" target="_top" id="LoginForm" onsubmit="doPCASLogin(this);">
  <input type="hidden" name="pstoken" value="2465670387a1nxrEimrKqPMN0c7QbxxKLNZe16PRC">
  <input type="hidden" name="contextData" value="4EDE156E2FAD0F1A427D2AD066530F496ADC3EEA78CE43E70F28053576FD4EA1">
  <input type="hidden" name="dbpw" value="">
  <input type="hidden" name="translator_username" value="">
  <input type="hidden" name="translator_password" value="">
  <input type="hidden" name="translator_ldappassword" value="">

<input type="hidden" name="returnUrl" value="">
<input type="hidden" name="serviceName" value="PS Parent Portal">
<input type="hidden" name="serviceTicket" value="">
<input type="hidden" name="pcasServerUrl" value="/">
<input type="hidden" name="credentialType" value="User Id and Password Credential">







              <h2>Parent Sign In</h2>
      <!--box content-->

    <div id="noscript" class="feedback-alert" style="display: none;"> To sign in to PowerSchool, you must use a browser that supports and has JavaScript enabled. </div>
    <fieldset id="login-inputs" class="group">

        <div>
              <label>Username</label>
              <input type="text" id="fieldAccount" name="account" value="" size="39">
        </div>
        <div>
              <label>Password</label>
              <input type="password" name="pw" value="" size="39"><div id="login-help"><a href="http://powerschool.avon.k12.ct.us/public/logonhelp.html">Having trouble signing in?</a></div>
        </div>
        <div id="translatorInput" style="display: none;">
              <label>Translator Sign In</label>
              <input type="password" name="translatorpw" value="" size="39">
        </div>
        <div class="button-row">
        <button type="submit" id="btn-enter" title="Sign In To PowerSchool Parent Access" value="Enter" border="0">Sign In</button>
        </div>
    </fieldset> 

      <!-- box content-->


</form>


 </div>
 <div id="footer" class="group">
    <p>Copyright© 2005 - 2013 Pearson Education, Inc., or its affiliate(s). All rights reserved.</p>
    <p id="pearsoncorplink"><a href="http://www.facebook.com/powerschool" class="popWin fb" title="Join us on Facebook">Join us on Facebook</a></p>
</div>

</div>
<div id="branding-pearson">
    <div id="logo-pearson"></div>
    <div id="tagline-pearson"></div>
</div>
<script type="text/javascript">
    /**
     * Set the page's locale via a request_locale URL parameter. If there is already a URL parameter by
     * this name, then substitute it with the passed-in locale. NOTE: This function will actually cause the page
     * to be re-submitted with the new locale, so it really should not be used with pages submitted via POST
     * requests (if there are any, which I hope there are not).
     * @param locale the locale to set (e.g. en_US)
     */
    function setPageLocale (locale) {
      var c=String (window.location);
      var rlpos = c.indexOf("request_locale=");
      var afterPart = "";
      if (rlpos > 0) {
        var afterBegin = c.indexOf("&", rlpos);
        if (afterBegin > 0) {
          afterPart = c.substring(afterBegin);
        }
        c = c.substring(0, rlpos-1);
      }
      var s=(c.indexOf('?') > 0 ? '&' : '?');
      var np = c + s + 'request_locale=' + locale + afterPart;
      window.location = np;
    }

    function jsCheck() {
            document.getElementById("login-inputs").className = 'group';

    }
 jsCheck();
</script>

<script>
$j('#noscript').hide();
function jsEnabled() {
    if(typeof $j != 'function'){
        alert('Developer: This page is missing key components required for functionality!\n\nPossible causes include:\n - Commonscripts might be missing.\n - Page customization might enabled, and incomplete.');
        //document.write('<script...');
        } else {
        $j('#login-inputs').removeClass('hide');
        $j("#fieldAccount").focus();
    }
}
$j(document).ready(function(){
    jsEnabled();
});

</script>


</body></html>

我想知道是否可以直接修改下载的源以自动填充输入框(下面的块是我认为可以完成的地方)以始终填写用户名并使用“myUsername”和“传递字段我的密码”或类似的东西。我尝试设置输入和用户名字段的值,但是(chrome)给了我一个,显示在这里:

No webpage was found for the web address: file:///C:/Users/Me/Desktop/Powerschool_files/Powerschool.htm

Error 6 (net::ERR_FILE_NOT_FOUND): The file or directory could not be found.

你们知道这是怎么做到的吗?

【问题讨论】:

    标签: html arguments webpage powerschool


    【解决方案1】:

    与其复制整个页面,不如制作一个填写表单的书签可能更简单。只需编辑一个普通书签并将链接更改为:

    javascript:(function() { document.forms[0].elements[0].value="hi" })()
    

    这将设置第一个表单中第一个字段的值。 (可能需要一些试验才能看到哪个表格编号和哪个字段编号。)

    【讨论】:

      【解决方案2】:

      您可能可以使用 Chrome 自动为您记住密码,但您所拥有的应该确实有效。您只需要更改任何指向 url 的路径即可使其完美运行。您肯定需要更改的是action

      - ./Powerschool_files/Powerschool.htm
      + https://example.com/Powerschool_files/Powerschool.htm
      

      这应该允许您直接提交到该站点,除非他们有我看不到的表单中的 CSRF 令牌。

      【讨论】:

      • Example.com?那应该是网站的地址吗?
      • 当我将其修改为正确的值时,chrome 会在地址栏中使用文件路径打开它。当我单击提交时,页面刷新并转到实际网页,其中包含空白字段。知道发生了什么吗?
      • @pipsqueaker117 不;我认为您的表单操作仍然不正确
      猜你喜欢
      • 2014-05-10
      • 2011-09-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-04-11
      • 2011-05-01
      相关资源
      最近更新 更多