第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

如何使用PhantomJS提交表單

如何使用PhantomJS提交表單

胡子哥哥 2019-11-05 10:30:23
我正在嘗試使用phantomJS(真棒的工具btw!)為具有登錄憑據(jù)的頁(yè)面提交表單,然后將目標(biāo)頁(yè)面的內(nèi)容輸出到stdout。我可以使用幻像訪問(wèn)該表單并成功設(shè)置其值,但是我不太確定提交表單并輸出后續(xù)頁(yè)面內(nèi)容的正確語(yǔ)法。到目前為止,我有:var page = new WebPage();var url = phantom.args[0];page.open(url, function (status) {  if (status !== 'success') {      console.log('Unable to access network');  } else {    console.log(page.evaluate(function () {      var arr = document.getElementsByClassName("login-form");      var i;      for (i=0; i < arr.length; i++) {        if (arr[i].getAttribute('method') == "POST") {          arr[i].elements["email"].value="mylogin@somedomain.com";          arr[i].elements["password"].value="mypassword";          // This part doesn't seem to work. It returns the content          // of the current page, not the content of the page after           // the submit has been executed. Am I correctly instrumenting          // the submit in Phantom?          arr[i].submit();          return document.querySelectorAll('html')[0].outerHTML;        }      }      return "failed :-(";    }));  }  phantom.exit();}
查看完整描述

3 回答

  • 3 回答
  • 0 關(guān)注
  • 259 瀏覽
慕課專(zhuān)欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)