davidofwatkins / ge-cancellation-checker

A PhantomJS script that checks your GOES account for a sooner Global Entry enrollment appointment
173 stars 74 forks source link

Unable to find Manage Appointment button #32

Open weilun106 opened 7 years ago

weilun106 commented 7 years ago

Hi all. I'm trying to use the script for my friend, which was working couple months ago for me. I got the following error,

Please wait...
On GOES login page...
Error on page: TypeError: null is not an object (evaluating 'document.querySelector('form[action=j_security_check]').submit')

  phantomjs://code/ge-cancellation-checker.phantom.js:55 in onError
Error on page: ReferenceError: Can't find variable: submitHome

  phantomjs://code/ge-cancellation-checker.phantom.js:55 in onError
Fatal error: Unable to find Manage Appointment button

I can get around the Can't find variable: submitHome by manually calling window.location to the full URL, props to @iokevins shared in #20. However, .bluebutton[name=manageAptm] does not seem to respond. Any ideas?

Also they have updated the location selection page from drop down menu. Not sure if it's going to affect the script. Cannot get it tested at the moment.

jowilki commented 7 years ago

Maybe SSL handshake issue, try this to debug:

page.onResourceError = function(resourceError) {
  console.log('Unable to load resource (#' + resourceError.id + 'URL:' + resourceError.url + ')');
  console.log('Error code: ' + resourceError.errorCode + '. Description: ' + resourceError.errorString);
};

and you can see if this works to confirm: phantomjs --ignore-ssl-errors=yes --ssl-protocol=tlsv1 ge-cancellation-checker.phantom.js

weilun106 commented 7 years ago

@jowilki Thanks for the response. I tried but it seems not the case. There's no error message after adding function(resourceError). I'm still getting Fatal error: Unable to find Manage Appointment button.

Just curious if I'm the only one who cannot get the script running on OSX? Found another guy getting the same issue on El Cap as well.

jowilki commented 7 years ago

This works for me as-is on OSX El Capitan (didnt need to change ssl params). What does the page.onResourceError return for you?

I don't think any of the html selectors have changed so it seems like there's some error with the request in your case. They did start using radial buttons instead of the dropdown, but that hasn't affected the script since the dom element is the same.

weilun106 commented 7 years ago

I added function(resourceError) under function(msg, trace), like this,

    if (!VERBOSE) { return; }
    console.error('Error on page: ' + msg);
}

page.onResourceError = function(resourceError) {
  console.log('Unable to load resource (#' + resourceError.id + 'URL:' + resourceError.url + ')');
  console.log('Error code: ' + resourceError.errorCode + '. Description: ' + resourceError.errorString);
};

Am I using it wrong? This is all I was getting and nothing really helps.

Please wait...
On GOES login page...
Error on page: TypeError: null is not an object (evaluating 'document.querySelector('form[action=j_security_check]').submit')

  phantomjs://code/ge-cancellation-checker.phantom.js:55 in onError
Bypassing human check...
Fatal error: Unable to find Manage Appointment button

I'm using OSX Sierra 10.12.1 though. Can confirm that it was fine when I was using El Cap.

jondubin commented 7 years ago

Has anyone found a fix for this yet? I can take a closer look at the bug, but was just wondering if someone else has already 😄

nereocystis commented 7 years ago

I see the same problem on Ubuntu, with slightly different output. Error discusses problem with loading local resource.

The name of the button looks fine, from perusing the console.

kevin@awabi:~/src/ge-cancellation-checker$ phantomjs ge-cancellation-checker.phantom.js -v Please wait... On GOES login page... Logging in... Bypassing human check... Not allowed to load local resource: file://ge-cancellation-checker.phantom.js/goes/HomePagePreAction.do Fatal error: Unable to find Manage Appointment button

mbgearhead commented 7 years ago

Hi nereocystis,

I had an identical problem using ubuntu 16.04 PhantomJS 2.1.1 (from apt). What us happening is that this script is not actually bypassing the "I'm human" check box correctly. I was able bypass this following the suggestion in this issue ([https://github.com/davidofwatkins/ge-cancellation-checker/issues/20]). By replacing: (line 109ish?) - submitHome(); with window.location = "https://goes-app.cbp.dhs.gov/goes/HomePagePre Action.do";

Let me know if this helps. Cheers!

jondubin commented 7 years ago

I also had to change the interval between steps from 100 ms to 200 ms, which is on the last line of the JS file.

wzaatar commented 7 years ago

I confirm having the same issue. I'm on Sierra 10.12.6 Tried @mbgearhead's suggestion on line 112 but that didn't fix the issue.

mbgearhead commented 7 years ago

Hi @wzaatar, did you try @jondubin suggestion to change the interval? Perhaps DHS is getting ahead of these automation apps again... As both I and my significant other already have global-entry, I unfortunately cannot debug this issue any longer. If someone else wants to take a crack at this, I'm happy to help out as needed