10

I found two posts on this but still doesn't seem to be working. I don't see the user.js script in the drop down menu on either firebug or the built-in firefox debugger. I'm still just learning coding and couldn't figure out the workaround strategies. Any help would be greatly appreciated.

How to debug Greasemonkey script on Firefox 30?

How to debug Greasemonkey script with the Firebug extension?

Firefox 35.0

Community
  • 1
  • 1
bigbucky
  • 407
  • 6
  • 20
  • After years of problems (and no real need by power developers), I don't think this is ever going to change. Learn to code without needing a debugger (Code: console first, atomic, DRY, and unit test). ... ... If you really *must* have a debugger, write first in Tampermonkey with the `Debug scripts` option enabled. Then Chrome debug tools work. If it works in Tampermonkey, it will then work in Greasemonkey -- with only a few exceptions. – Brock Adams Jan 15 '15 at 03:21
  • Thanks! Looks like I've got some reading to do. – bigbucky Jan 16 '15 at 03:38
  • http://stackoverflow.com/questions/25056395/how-to-debug-greasemonkey-scripts-in-firebug – tsh Jan 16 '15 at 04:33
  • 4
    @tsh, Sadly, those previous answers were only effective for a time (and to limited extent -- except for the workaround parts). They seem to be obsolete now. – Brock Adams Jan 16 '15 at 23:14

1 Answers1

2

The only way I've found to debug greasemonkey scripts is to use the browser console to get clues and then add alerts in my code where I think the problem is... then if the alert doesn't show up I know the problem is earlier in the code. My code usually ends up looking kinda like this pseudo code:

var i = get.value.from.page

alert(i)


do stuff to i

alert(i)

if (i===5){
do this stuff
alert ("i equaled 5")
}
else{
do this stuff instead
alert("i didn't equal 5, it equaled "+i)
}

Yeah, it's messy and time consuming... but it works.

Kat Cox
  • 3,469
  • 2
  • 17
  • 29