kevinabrandon / AboveTustin

ADS-B Twitter Bot. Uses dump1090-mutability to track airplanes and then tweets whenever an airplane flies overhead.
MIT License
72 stars 21 forks source link

UserWarning: Selenium support for PhantomJS has been deprecated, please use headless versions of Chrome or Firefox instead #36

Open cm2339 opened 5 years ago

cm2339 commented 5 years ago

Hi All,

I'm absolutely new to ADSB and not very familiar with Linux and find it super interesting. I ran into this add-on while installing the adsb exchange package and would love to add it to my Pi running it. Everything else is working but when i try to run ./run_tracker.sh to start the script(i hope that's how you start it) i get the error in the tittle. I've been looking around the web and in the files to try and figure out how to make it so selenium uses either Firefox or Chromium in headless move but have not been able to figure it out.

I do realize this is an issues board and this is probably me not being very familiar with this but figure i would start here and try and get help from the source. Thanks!

cm2339 commented 5 years ago

Disregard! After reading the error carefully i figured where to change the default from Phantom to Firefox. This script is amazing!

kevinabrandon commented 5 years ago

Glad you figured it out, I'm scared that if my old pi running Phantom ever dies I'm going to run into the same problem. Could you let me know how you made the change? Did you have to install anything else (like firefox or chromium)? Also what's your twitter handle?

cm2339 commented 5 years ago

Hi @kevinabrandon ,

I went to screenshot.py and changed line 95 from: browser = webdriver.PhantomJs(desired_capabilities={'phantomjs.page.settings.resourceTimeout': '20000'}) to: browser = webdriver.Firefox(desired_capabilities={'firefox.page.settings.resourceTimeout': '20000'}) I did download Firefox and for some reason, this works even tho the script launches Chromium... So i wouldn't call it a fix, maybe a botch 👯‍♂️

My handle is wako0. I did just sent it to my personal twitter for the sake of testing and stopped it before going to bed. Later on, i will be deploying near Half Moon Bay here in California to monitor airplanes flying near the bird sanctuary.

One thing i couldn't figure out was the FA API key. Apparently they don't hand them out anymore even when you're feeding to them... oh well.

Cheers!

mattlabate commented 5 years ago

This was an awesome, and necessary fix for me. Two questions I'm working on is:

** I used a Pi, with ADSB Receiver (and AboveTustin) installed, to create a twitter account that tweets every time a plane flies overhead (under 4K feet).

The account is here (https://twitter.com/above_carpenter), and for anybody interested in duplicating what I did, you can see step by step here: https://docs.google.com/document/d/1Ce2W1gocX7U-KHuiw7pEQQj5fjZ2ShqRsajj3dEmp-8/edit

cm2339 commented 5 years ago

@mattlabate

I've yet to run into the freezing issues that you're having, i'll keep my eyes open and let you know if i do and if i managed to fix it. Also, I didn't edit the second line either and have yet ran into any issues.

I do have a question/s for you. Would it be possible to take a look at your tweet alarm settings? I'd love to only capture flights under 2000ft (mine does anything within 1 mile). Also, thanks for the Zapier hint, i just finished setting it up and works perfectly. How did you manage to separate the data into columns like you did? It looks so much better. Thanks in advance!

mattlabate commented 5 years ago

Sure! This is probably not the best practice at all, but I actually did it in the tweet settings in tracker.py, starting at line 123:

# send tweet to twitter!
if havescreenshot and a.altitude <= 4000:
    with open('tweet.png', "rb") as imagefile:
        imagedata = imagefile.read()
    params = {"media[]": imagedata, "status": tweet}
    twit.statuses.update_with_media(**params)
elif a.altitude <= 4000:
    twit.statuses.update(status=tweet)

# send the tweet to stdout while we're at it
print(tweet)

And the Gsheet just takes the tweet (which I structured to have data separated by spaces, and then used this to split into columns:

=IF(ISBLANK(D41),"blank",split(D41, " "))

Here's my log errors from the firefox hourly reboot, trying to google to see issue:

May 06 19:58:21 raspberrypi rc.local[409]: selenium.common.exceptions.WebDriverException: Message: Can't load the profile. Possible firefox version mismatch.

cm2339 commented 5 years ago

Which version of Firefox did you install?

mattlabate commented 5 years ago

Mozilla Firefox 52.9.0 (specifically, I used firefox-esr to install.)

cm2339 commented 5 years ago

Did you add anything to your rc.local file to run on boot that might be causing a conflict? I know the adsb project installation adds run_tracker.sh and adsbexchange-socat_maint.sh to try and run them at boot. Mine didn't work and that's why i had to use LXDe-pi which keeps my terminal screen always open.

mattlabate commented 5 years ago

I removed that, and it's still an issue. I've tracked down there there's version mismatch between firefox, selenium, and python. Need to dig into this further. REF: https://stackoverflow.com/questions/45692626/unable-to-load-firefox-in-selenium-webdriver-in-python