javascript - Firefox extension: how to fill an input text field -
i have custom toolbar button created in accordance tutorial. javascript code button following:
custombutton = { 1: function () { alert("just testing") }, }
and works. when click on button, alert happens. i'm trying make changes, namely, fill input field on clicking button, piece of code doesn't work:
custombutton = { 1: function () { document.getelementbyid("loginusername").value = "aaaa"; }, }
the element id "loginusername" exists on page. can fill selenium webdriver:
driver.findelement(by.id("loginusername")).sendkeys(user).
so question why doesn't work in firefox extension?
thanks, racoon
your toolbar button , input field (assuming latter part of web page) live in separate documents. it's easy cross boundary. change code to
gbrowser.contentdocument.getelementbyid("loginusername").value = "aaaa";
Comments
Post a Comment