flightplan-tool / flightplan

Search for award inventory using Node.js and Headless Chrome!
Apache License 2.0
140 stars 41 forks source link

CX parser can't locate search fields #55

Open asgillmor opened 4 years ago

asgillmor commented 4 years ago

The elements in the DOM look very different than what is described in the parser for the page given.

Error: No node found for selector: #input-origin
    at assert (/Users/alex/.nvm/versions/node/v11.15.0/lib/node_modules/flightplan-tool/node_modules/puppeteer/lib/helper.js:270:11)
    at DOMWorld.click (/Users/alex/.nvm/versions/node/v11.15.0/lib/node_modules/flightplan-tool/node_modules/puppeteer/lib/DOMWorld.js:366:5)
    at processTicksAndRejections (internal/process/task_queues.js:86:5)
  -- ASYNC --
    at Frame.<anonymous> (/Users/alex/.nvm/versions/node/v11.15.0/lib/node_modules/flightplan-tool/node_modules/puppeteer/lib/helper.js:111:15)
    at Page.click (/Users/alex/.nvm/versions/node/v11.15.0/lib/node_modules/flightplan-tool/node_modules/puppeteer/lib/Page.js:1031:29)
    at module.exports.setCity (/Users/alex/.nvm/versions/node/v11.15.0/lib/node_modules/flightplan-tool/src/engines/cx/searcher.js:308:16)
    at module.exports.search (/Users/alex/.nvm/versions/node/v11.15.0/lib/node_modules/flightplan-tool/src/engines/cx/searcher.js:60:16)
[CX] DEPARTURE [HKG -> SFO] - 2020-01-01 (2 Passengers)
jd20 commented 4 years ago

It's likely the website HTML has changed quite a bit since the last update to the CX parser. Feel free to submit a PR to bring it up to date.

asgillmor commented 4 years ago

Okay! I'll probably submit one for Aeroplan first because the fix there was trivial.

The CX markup has become very react-ified and a bit more difficult, I'll take a look.

ardidi commented 4 years ago

It is really difficult to click and search react form, after research the asiamiles site I think this can be done by using GET request. Asiamiles can use following URL to search award ticket.

https://api.asiamiles.com/redibe/IBEFacade?RETURNURL=https%3A%2F%2Fwww.asiamiles.com%2Fzh%2Fredeem-awards%2Fflight-awards%2Ffacade.html%3Frecent_search%3Dow&ENTRYCOUNTRY=HK&DEPARTUREDATE=20191129&MEMBERID=&ENTRYPOINT=https%3A%2F%2Fwww.asiamiles.com%2Fzh%2Fredeem-awards%2Fflight-awards%2Ffacade.html%3FIBERedeemType_byDest&CHILD=0&ENCRYPTSWITCH=true&ADULT=1&FLEXIBLEDATE=false&ENTRYLANGUAGE=zh&ISSEARCHBYMILES=FALSE&ORIGIN=HKG&ACTION=RED_AWARD_SEARCH&CABINCLASS=C&DESTINATION=YVR&ERRORURL=https%3A%2F%2Fwww.asiamiles.com%2Fzh%2Fredeem-awards%2Fflight-awards%2Ffacade.html%3Frecent_search%3Dow&INFANT=0&TRIPTYPE=O&brand=AM&isChecked=TRUE

dingwa commented 4 years ago

Any ideas on how best to get CX website working again? I've made a feeble attempt at getting the updated website working however to no avail

byteofmydream commented 4 years ago

I updated selectors for CX website in this PR: https://github.com/flightplan-tool/flightplan/pull/72