Bir krom uzantısı yapıyorum. Bu uzantının bir bölümü, sayfadaki onClick etkinliklerini etkinleştirmek için bir tıklamayı simüle edebilmelidir. İşteSimulated Click to Chrome Extension
function checkForValidUrl(tabId, changeInfo, tab) {
// If the letter 'g' is found in the tab's URL...
if (tab.url.indexOf('maps') > -1 && tab.url.indexOf('google') > -1) {
// ... show the page action.
chrome.pageAction.show(tabId);
}
};
// Listen for any changes to the URL of any tab.
chrome.tabs.onUpdated.addListener(checkForValidUrl);
chrome.pageAction.onClicked.addListener(function() {
document.getElementById("paneltoggle2").click();
});
Ben Chrome'un java script hata ayıklama gelen alıyorum hata mesajı olup:
Error in event handler for 'pageAction.onClicked': Cannot call method 'click' of null TypeError: Cannot call method 'click' of null
at chrome-extension://deogcaeekneeagffbhdlflichjlodlem/js/main.js:26:42
at chrome.Event.dispatchToListener (event_bindings:387:21)
at chrome.Event.dispatch_ (event_bindings:373:27)
at dispatchArgs (event_bindings:249:22)
at Object.chromeHidden.Event.dispatchEvent (event_bindings:257:7) event_bindings:377
chrome.Event.dispatch_ event_bindings:377
dispatchArgs event_bindings:249
chromeHidden.Event.dispatchEvent event_bindings:257
Ben izinlerle ilgili bir şey olduğunu tahmin ediyorum Burada arka plan komut dosyasından kodudur manifest dosyasında ... Şu anda sadece "sekmeler" için izinlerim var. Tıklamayı simüle etmek ve bir hata almamak için etkinleştirmem gereken başka izinler var mı? Oh ve bu sürüm 2 manifest protokolü ile yetenekli yapmaya çalışıyorum.
sayesinde Leinardo
mükemmel çalıştı. Çok teşekkür ederim! –