0
.Netフォームを送信してから、応答ページから要素を取得しようとしています。 CasperJSは単にフォームページをリロードするため、.Netフォームは正しく送信されないようです。 Google検索結果を保存するCasperJSの例はうまく動作しますが、このフォームではレスポンスページが読み込まれません。CasperJSを使用して.NETフォームを正常に送信する方法
var casper = require("casper").create({
verbose: true,
logLevel: "debug",
});
casper.start("https://jobs.ca.gov/Public/JobVacancySearch.aspx", function(){
this.fill('#form1', {'ctl00$cphMainContent$txtJobTitle': 'Programmer'}, true);
this.waitForSelector("#cphMainContent_gvSearchResults");
});
casper.run(function(){
console.log("success");
});
これが出力されます:あなたは、フォームは、この問題を解決したように見える記入後
casperjs so-test.js --config=<(echo '{"sslProtocol": "any"}') --ignore-ssl-errors=true
[info] [phantom] Starting...
[info] [phantom] Running suite: 2 steps
[debug] [phantom] opening url: https://jobs.ca.gov/Public/JobVacancySearch.aspx, HTTP GET
[debug] [phantom] Navigation requested: url=https://jobs.ca.gov/Public/JobVacancySearch.aspx, type=Other, lock=true, isMainFrame=true
[debug] [phantom] url changed to "https://jobs.ca.gov/Public/JobVacancySearch.aspx"
[debug] [phantom] Navigation requested: url=https://jobs.ca.gov/MasterContent/headerSiteSearch.html, type=Other, lock=true, isMainFrame=false
[debug] [phantom] Navigation requested: url=https://jobs.ca.gov/MasterContent/headerSiteSearch.html, type=Other, lock=true, isMainFrame=false
[debug] [phantom] Successfully injected Casper client-side utilities
[info] [phantom] Step 2/2 https://jobs.ca.gov/Public/JobVacancySearch.aspx (HTTP 200)
[info] [remote] attempting to fetch form element from selector: '#form1'
[debug] [remote] Set "ctl00$cphMainContent$txtJobTitle" field value to Programmer
[info] [remote] submitting form to ./JobVacancySearch.aspx, HTTP POST
[info] [phantom] Step 2/2: done in 2070ms.
[debug] [phantom] Navigation requested: url=https://jobs.ca.gov/Public/JobVacancySearch.aspx, type=FormSubmitted, lock=true, isMainFrame=true
[debug] [phantom] url changed to "https://jobs.ca.gov/Public/JobVacancySearch.aspx"
[debug] [phantom] Navigation requested: url=https://jobs.ca.gov/MasterContent/headerSiteSearch.html, type=Other, lock=true, isMainFrame=false
[debug] [phantom] Navigation requested: url=https://jobs.ca.gov/MasterContent/headerSiteSearch.html, type=Other, lock=true, isMainFrame=false
[debug] [phantom] Successfully injected Casper client-side utilities
[info] [phantom] Step 3/3 https://jobs.ca.gov/Public/JobVacancySearch.aspx (HTTP 200)
[info] [phantom] Step 3/3: done in 2355ms.
[warning] [phantom] Casper.waitFor() timeout
[error] [phantom] Wait timeout of 5000ms expired, exiting.
Wait timeout of 5000ms expired, exiting.
何が起こったかを確認するには、スクリーンショットを撮ってください。これは 'waitForSelector'の' onTimeout'コールバックに入ります –
このスクリーンショットは何の洞察も明らかにしていません。画面にメッセージはありません。デバッグメッセージは、フォームが送信されると、JobVacancySearch.aspxに戻ります –