-1

In firebug I want to automate running a console command like this:

holder += ($p).innerHTML + '\n'; copy(holder)

..to run each time a page element (selected and stored in $p) loads new HTML. I'm using Firebug and there in HTML tab we can right-click on an element and "Use in Command Line" which puts the CSS Path of the element in a variable $p. (can also use $0, $1 etc) I'm looking in Firebug's reference for a way to trigger this, but can't find anything right now. Any ideas of how to go about it? Also open to using tools other than Firebug for this.

Updates:

Desired trigger: 3 seconds after another HTML element on the same page : a dropdown, changes value. Alternatively, fire trigger after target element finishes loading following from ajax query.

In windows enviromment I have automated mouse-clicks and keystrokes on screen using AutoHotKey to change the focus from page to console (by clicking in it), enter the command, then change focus back to page and repeat the operation. But it's a crude solution that has to be pixel-fine-tuned each time and can change on different devices.

I'm getting suggestions to create a browser add-on of my own. Apologies but I presently have zero experience in creating add-ons and am wondering if it is a more complicated way of achieving something simpler? Some reference on how to get started on that trajectory, relating to this particular situation, would be highly appreciated if it was mentioned with the suggestion.

Nikhil VJ
  • 2,860
  • 3
  • 25
  • 41
  • 1
    Well, for something that sounds this repetitive, the solution I would go for this is to create a small add-on which performed the whole process for me. I would just have it watch for the change, or the web traffic, which indicates new information is available. Then, get the new information and place it where I wanted it without me having to spend the time/effort to copy and paste it. It does not sound like interfacing with Firebug would be the most efficient way to do this. – Makyen Nov 04 '16 at 04:44
  • sorry. shortened the question. what other way would you advise? – Nikhil VJ Nov 04 '16 at 16:55
  • This looks like a question which is an [XY problem](https://www.google.com/search?as_q=XY+problem). Your question was probably better prior to your recent edit. Prior to the edit it explained what you were trying to accomplish rather than focusing on Firebug being the way to accomplish it. Given that the text says you remain open to using other methods of accomplishing this, I would suggest [rolling back your edit](http://stackoverflow.com/posts/40414896/revisions). – Makyen Nov 04 '16 at 17:04
  • How do you obtain `$p` (not showing how this is obtained effectively limits any actual code solutions to only being in Firebug)? Are you wanting the contents of the clipboard to automatically stay in sync with the dynamically updated element? Are you only wanting it to update upon clicking a button? – Makyen Nov 04 '16 at 17:09
  • Note that [Firebug does not work anymore once multi-process Firefox is enabled](https://blog.getfirebug.com/2016/06/07/unifying-firebug-firefox-devtools/). – Sebastian Zartner Nov 10 '16 at 12:05

1 Answers1

0

Only the Console API is accessible from within website content. The Command Line API is only available within Firebug's command line or from within other privileged content, i.e. other extensions, for example.

If copying something to the clipboard using JavaScript is your only use case, you should have a look at How do I copy to the clipboard in JavaScript?.

Otherwise you may want to write an add-on that does what you want.

Community
  • 1
  • 1
Sebastian Zartner
  • 16,477
  • 8
  • 74
  • 116