开发者

Run firefox addons from command-line

I am working 508 accessible standard for a website. There are a Firefox plugin to help check on each page a website WAVE addons

I am having a crawler that walk throught all pages of the website.

Now i want to combine WAVE addons + my crawler to check website as 508 accessibility compliance aut开发者_开发百科omatically.

My question is how to run Firefox addons with a specific URL from command line?

Thanks for your help,

Minh


You could do many complex thing from comand line as running inline javascript (I've posted a Color RGB shower using firefox 'data:text/html.. under Another bash approach, at bottom of answer).

Maybe this could help you:

$ firefox 'data:text/html;charset=ISO-8859-1,
<html>
<head>
<title>TEST Demo</title>
</head>
<body>
<h3 id="title">Test demo</h3>
<script language="javascript">
window.open("http://perso.f-hauri.ch/~felix/svg/dustin_w_Clock_autonom.svg","clock","toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1,width=400,height=400,top=36,left=700");                                     
window.open("https://stackexchange.com/users/flair/1965184.png","netrate","toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=0,width=208,height=58,top=36,left=490");
var s=10;                                                                 
function cntdwn()                                          
{                                                                 
  document.getElementById("title").innerHTML="Test demo: "+s;s=s-1;
  if (0 > s)                                                      
  {                                                                      
    window.location="https://stackoverflow.com/a/13013464/1765658";
  }                                                                      
  else window.setTimeout(cntdwn,1000);
  };                                        
  window.onload=cntdwn;
 </script>
 </body>'

This could be written:

$ firefox 'data:text/html;charset=ISO-8859-1,<html><body><h3 id="title"></h3>'"$(
    cat <<eof
        <script language="javascript">
        var s=10;
        function cntdwn() {
            document.getElementById("title").innerHTML="Test demo: "+s;s=s-1;
            if (0 > s) {
                window.location="https://stackoverflow.com/a/13013464/1765658";
            }
            else window.setTimeout(cntdwn,1000);
        };
        window.onload=cntdwn;
        window.open("http://perso.f-hauri.ch/~felix/svg/dustin_w_Clock_autonom.svg","clock","toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1,width=400,height=400,top=36,left=700");                                     
        window.open("https://stackexchange.com/users/flair/1965184.png","netrate","toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=0,width=208,height=58,top=36,left=490");
        </script>  </body>
eof
)"

Or even:

$ firefox 'data:text/html;charset=ISO-8859-1;base64,PGh0bWw+PGhlYWQ+PHRpdGxlPlRF
U1QgRGVtbzwvdGl0bGU+PC9oZWFkPjxib2R5PjxoMyBpZD0idGl0bGUiPlRlc3QgZGVtbzwvaDM+PHNj
cmlwdCBsYW5ndWFnZT0iamF2YXNjcmlwdCI+d2luZG93Lm9wZW4oImh0dHA6Ly9wZXJzby5mLWhhdXJp
LmNoL35mZWxpeC9zdmcvZHVzdGluX3dfQ2xvY2tfYXV0b25vbS5zdmciLCJjbG9jayIsInRvb2xiYXI9
MCxsb2NhdGlvbj0wLHN0YXR1cz0wLG1lbnViYXI9MCxzY3JvbGxiYXJzPTEscmVzaXphYmxlPTEsd2lk
dGg9NDAwLGhlaWdodD00MDAsdG9wPTM2LGxlZnQ9NzAwIik7d2luZG93Lm9wZW4oImh0dHBzOi8vc3Rh
Y2tleGNoYW5nZS5jb20vdXNlcnMvZmxhaXIvMTk2NTE4NC5wbmciLCJuZXRyYXRlIiwidG9vbGJhcj0w
LGxvY2F0aW9uPTAsc3RhdHVzPTAsbWVudWJhcj0wLHNjcm9sbGJhcnM9MCxyZXNpemFibGU9MCx3aWR0
aD0yMDgsaGVpZ2h0PTU4LHRvcD0zNixsZWZ0PTQ5MCIpO3ZhciBzPTEwO2Z1bmN0aW9uIGNudGR3bigp
e2RvY3VtZW50LmdldEVsZW1lbnRCeUlkKCJ0aXRsZSIpLmlubmVySFRNTD0iVGVzdCBkZW1vOiAiK3M7
cz1zLTE7aWYgKDAgPiBzKXt3aW5kb3cubG9jYXRpb249Imh0dHBzOi8vc3RhY2tvdmVyZmxvdy5jb20v
YS8xMzAxMzQ2NC8xNzY1NjU4Ijt9ZWxzZSB3aW5kb3cuc2V0VGltZW91dChjbnRkd24sMTAwMCk7fTt3
aW5kb3cub25sb2FkPWNudGR3bjs8L3NjcmlwdD48L2JvZHk+'

(Care to split Base64 by multiple of 4 chars!)

This work same with chromium and, I believe, near every browser...


Add-ons can't be "run" (what does it mean to run Adblock from command line, for example?).

If the add-ons you're using do not support command-line params. you can write an extension that checks the command line and calls an appropriate function of the whatever other add-on you want to "run".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜