AboveTustin icon indicating copy to clipboard operation
AboveTustin copied to clipboard

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

Open cm2339 opened this issue 5 years ago • 10 comments

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 avatar Feb 18 '19 08:02 cm2339

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

cm2339 avatar Feb 18 '19 08:02 cm2339

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?

kevinabrandon avatar Feb 18 '19 16:02 kevinabrandon

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!

cm2339 avatar Feb 18 '19 19:02 cm2339

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

  • It seems that there's a browser reload every hour. Sometimes an error will freeze the first firefox window, and then the auto reload will open a second browser window. Still tracking down if this fails the script and/or if there's a way for it to gracefully reboot entire program.

  • There's another class (VRSDisplay(AircraftDisplay)) which calls the same PhantomJS you mentioned above for a fix. I didn't replace it with the new line you created, but everything seems to be working. I need to trackdown sometime whether I need to change that line also.

** 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

mattlabate avatar May 07 '19 00:05 mattlabate

@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!

cm2339 avatar May 07 '19 02:05 cm2339

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.

mattlabate avatar May 07 '19 04:05 mattlabate

Which version of Firefox did you install?

cm2339 avatar May 07 '19 15:05 cm2339

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

mattlabate avatar May 07 '19 15:05 mattlabate

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.

cm2339 avatar May 07 '19 16:05 cm2339

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

mattlabate avatar May 07 '19 17:05 mattlabate