使用PhantomJS登录https://www.amazon.com/ap/signin

时间:2016-06-13 04:38:06

标签: javascript phantomjs

也许我正在让这个变得更加复杂。我正在学习Phantom JS我想我可以使用它来自动将Android App提交到Amazon App Store / Amazon Developer Console。登录页面包含以下网址:http://developer.amazon.com/home.html

重定向到超长网址,并提供表单以输入用户名和密码以及点击按钮。如果查看页面源代码,您会看到一个包含各种隐藏输入的表单。以下是来自页面源的实际表单标记的一部分:

<form name="signIn" method="POST" id="ap_signin_form" novalidate="novalidate" action="https://www.amazon.com/ap/signin" onsubmit="var test1 = apCheckRequiredFields('ap_signin_form', ['ap_email','ap_password']);
        return (apValidateEmail('ap_email') &amp;&amp; test1);">
      <input type="hidden" name="appActionToken" value="scIhj2FOCtxr39z7eUIj2FWeNOWxtIwj3D"><input type="hidden" name="appAction" value="SIGNIN">
                <input type="hidden" name="openid.pape.max_auth_age" value="ape:MQ==">
                <input type="hidden" name="openid.return_to" value="ape:aHR0cHM6Ly9kZXZlbG9wZXIuYW1hem9uLmNvbS9hcF9sb2dpbi82ODc0NzQ3MDczM0EyRjJGNjQ2NTc2NjU2QzZGNzA2NTcyMkU2MTZENjE3QTZGNkUyRTYzNkY2RDJGNjg2RjZENjUyRTY4NzQ2RDZDLmh0bWw=">
                <input type="hidden" name="prevRID" value="ape:N1RBVEM3SFQxSEdXRTNITUFENEs=">
                <input type="hidden" name="openid.identity" value="ape:aHR0cDovL3NwZWNzLm9wZW5pZC5uZXQvYXV0aC8yLjAvaWRlbnRpZmllcl9zZWxlY3Q=">
                <input type="hidden" name="openid.assoc_handle" value="ape:bWFzX2Rldl9wb3J0YWw=">
                <input type="hidden" name="openid.mode" value="ape:Y2hlY2tpZF9zZXR1cA==">
                <input type="hidden" name="language" value="ape:ZW5fVVM=">
                <input type="hidden" name="openid.claimed_id" value="ape:aHR0cDovL3NwZWNzLm9wZW5pZC5uZXQvYXV0aC8yLjAvaWRlbnRpZmllcl9zZWxlY3Q=">
                <input type="hidden" name="pageId" value="ape:bWFzX2Rldl9wb3J0YWwy">
                <input type="hidden" name="openid.ns" value="ape:aHR0cDovL3NwZWNzLm9wZW5pZC5uZXQvYXV0aC8yLjA=">
  <div id="ap_signin1a_pagelet" class="ap_table ap_pagelet">
    <div id="ap_signin1a_pagelet_title" class="ap_row ap_pagelet_title">
      <h1>Sign In </h1>
    </div>
    <div id="ap_signin1a_email_section_title" class="ap_row ap_section_title">
      <h2>
            What is your email (phone for mobile accounts)?

... even more html here ... 

我对Phantom JS代码的假设感到困惑。我是否需要收集所有这些隐藏的输入并构建一个表单数据对象以便在POST请求中发送?或者我只需要弄清楚我需要将哪些DOM对象设置为我的凭据然后生成按钮单击事件?

0 个答案:

没有答案