flightplan-tool / flightplan

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

AC one-way search failing with "Missing form element: tripTypeOneWay" #51

Open zedkyuu opened 5 years ago

zedkyuu commented 5 years ago

Log output:

[AC] error Unexpected error occurred while searching!
Error: Evaluation failed: Error: Missing form element: tripTypeOneWay
    at __puppeteer_evaluation_script__:6:19
    at ExecutionContext.evaluateHandle (/home/zq/node_modules/puppeteer/lib/ExecutionContext.js:121:13)
    at process._tickCallback (internal/process/next_tick.js:68:7)
  -- ASYNC --
    at ExecutionContext.<anonymous> (/home/zq/node_modules/puppeteer/lib/helper.js:110:27)
    at ExecutionContext.evaluate (/home/zq/node_modules/puppeteer/lib/ExecutionContext.js:48:31)
    at ExecutionContext.<anonymous> (/home/zq/node_modules/puppeteer/lib/helper.js:111:23)
    at DOMWorld.evaluate (/home/zq/node_modules/puppeteer/lib/DOMWorld.js:112:20)
  -- ASYNC --
    at Frame.<anonymous> (/home/zq/node_modules/puppeteer/lib/helper.js:110:27)
    at Page.evaluate (/home/zq/node_modules/puppeteer/lib/Page.js:782:43)
    at Page.<anonymous> (/home/zq/node_modules/puppeteer/lib/helper.js:111:23)
    at module.exports.fillForm (/home/zq/node_modules/flightplan-tool/src/Searcher.js:160:17)
    at module.exports.search (/home/zq/node_modules/flightplan-tool/src/engines/ac/searcher.js:57:18)

I don't know JS, but I did look at the Aeroplan search page and found that the element seems to be named "tripTypeRoundTrip" and so I subbed that into the code. It seems to work now, but I don't really know yet if the data is worth anything.

zubairv85 commented 5 years ago

That seems right. The name of the round trip and one way radio button is 'tripTypeRoundTrip' so changing the value 'tripTypeOneWay' to 'tripTypeRoundTrip' as you did is the fix.

zubairv85 commented 5 years ago

I issued a pull request to fix this.