- Mar 22, 2013
- 9,146
- 10,489
I have a Firefox extension that clicks a certain button, and it works well.
This code does the clicking:
My problem is that the extension clicks every 5 seconds, and I want it to do so, but only if an additional element is true.
This is the code the extension clicks:
So the code changes sometimes, as you can see above. As long as the extension just clicks on "ooo-qqq-vvv" it will click every 5 seconds.
But if I can make it click on "ooo-qqq-vvv + One (p)" and also on "ooo-qqq-vvv + Two (p)" then I can have it work how I want. So both the class and title or aria-label to be true in order to make a successful click.
I feel like it's a simple edit, maybe something like this:
Anyone knows? @Gogol
This code does the clicking:
Code:
function xxBtn(){
var btn = document.querySelector('button.ooo-qqq-vvv')
if( !btn ){ return }
btn.click()
}
My problem is that the extension clicks every 5 seconds, and I want it to do so, but only if an additional element is true.
This is the code the extension clicks:
Code:
<button class="ooo-qqq-vvv zzz-ttt" aria-label="One (k)" title="One (p)">
Code:
<button class="ooo-qqq-vvv zzz-ttt" aria-label="One (k)" title="Two (p)">
Code:
<button class="ooo-qqq-vvv zzz-ttt" aria-label="One (k)" title="Three (p)">
So the code changes sometimes, as you can see above. As long as the extension just clicks on "ooo-qqq-vvv" it will click every 5 seconds.
But if I can make it click on "ooo-qqq-vvv + One (p)" and also on "ooo-qqq-vvv + Two (p)" then I can have it work how I want. So both the class and title or aria-label to be true in order to make a successful click.
I feel like it's a simple edit, maybe something like this:
Code:
function xxBtn(){
var btn = document.querySelector('button.ooo-qqq-vvv').getAttribute("title=('One (p)')");
if( !btn ){ return }
btn.click()
}
Anyone knows? @Gogol