R
rainer.blickle
Hi to everybody,
i'm trying to simulate a button click, but it doesn't work.
What i'm trying to do ?:
I try to write a little helper for my google mail account. After login
the incoming mail folder is displayed. a little java script marks some
of the incoming mail (done via xpath). The script is executed via
greasemonkey (Firefox).
Code:
if (document.URL.match(/^http:\/\/mail.google.com\/mail\/.*$/)) {
var varn0_iterator = document.evaluate("//tr[TD/span/text()='GMX
Best Price' or td/span/b/text()='GMX Best Price']/td/input", document,
null, XPathResult.ANY_TYPE,null);
var varn0 = varn0_iterator.iterateNext();
while (varn0) {
varn0.checked="true";
varn0 = varn0_iterator.iterateNext();
};
}
So, now the "spam" is marked and i want to move it into the archive
via the "archive"-button.
The button is defined via:
<BUTTON style="font-weight: bold;" id="ac_rc_^i" class="ab"
type="button">
Archivieren</BUTTON>
(i got the definition via the "DOM Inspector" plugin of firefox).
So, the checkboxes are marked for the "spam". now i tried to do a
click via
document.evaluate("//button[text()='Archivieren']", document, null,
XPathResult.ANY_TYPE,null).iterateNext().click();
but this doesn't work. The xpath returns a button, but the click
doesn't make any effect. As you can see, i am a german user of gmail.
Can anybody help me how to simulate a button click ?
Any additional information needed ?
Regards Rainer
i'm trying to simulate a button click, but it doesn't work.
What i'm trying to do ?:
I try to write a little helper for my google mail account. After login
the incoming mail folder is displayed. a little java script marks some
of the incoming mail (done via xpath). The script is executed via
greasemonkey (Firefox).
Code:
if (document.URL.match(/^http:\/\/mail.google.com\/mail\/.*$/)) {
var varn0_iterator = document.evaluate("//tr[TD/span/text()='GMX
Best Price' or td/span/b/text()='GMX Best Price']/td/input", document,
null, XPathResult.ANY_TYPE,null);
var varn0 = varn0_iterator.iterateNext();
while (varn0) {
varn0.checked="true";
varn0 = varn0_iterator.iterateNext();
};
}
So, now the "spam" is marked and i want to move it into the archive
via the "archive"-button.
The button is defined via:
<BUTTON style="font-weight: bold;" id="ac_rc_^i" class="ab"
type="button">
Archivieren</BUTTON>
(i got the definition via the "DOM Inspector" plugin of firefox).
So, the checkboxes are marked for the "spam". now i tried to do a
click via
document.evaluate("//button[text()='Archivieren']", document, null,
XPathResult.ANY_TYPE,null).iterateNext().click();
but this doesn't work. The xpath returns a button, but the click
doesn't make any effect. As you can see, i am a german user of gmail.
Can anybody help me how to simulate a button click ?
Any additional information needed ?
Regards Rainer