我正在开发一个chrome插件。它会检查按钮是否连续启用。如果已启用,则会单击它。我使用无限循环,但浏览器冻结。我怀疑这可能不是一个好主意。这是 runscript.js 文件
for (;;) {
if ($('[class="abcd"]').disabled == false) {
$('[class="abcd"]').click();
break;
} else {
console.log('button disabled');
}
}
这里是 manifest.json 文件
{
"name": "First extension",
"version": "1.0",
"manifest_version": 2,
"description": "My extension",
"browser_action": {
"default_icon": "icon.png",
"default_menu": "Menu",
"default_popup": "popup.html"
},
"icons": {
"128": "icon.png"
},
"permissions": [
"tabs",
"http://*/*",
"activeTab"
],
"content_scripts": [
{
"matches": [
"https://*/*"
],
"js": [
"jquery-3.3.1.min.js",
"runscript.js"
]
}
]
}
有关如何正确使用它的任何建议吗?
答案 0 :(得分:1)
尝试这样的事情:
NoMethodError: undefined method `[]' for nil:NilClass
from /home/yechielk/.rvm/gems/ruby-2.4.2/gems/actionpack-5.1.4/lib/action_controller/metal/request_forgery_protection.rb:374:in `real_csrf_token'
from /home/yechielk/.rvm/gems/ruby-2.4.2/gems/actionpack-5.1.4/lib/action_controller/metal/request_forgery_protection.rb:381:in `per_form_csrf_token'
from /home/yechielk/.rvm/gems/ruby-2.4.2/gems/actionpack-5.1.4/lib/action_controller/metal/request_forgery_protection.rb:302:in `masked_authenticity_token'
from /home/yechielk/.rvm/gems/ruby-2.4.2/gems/actionpack-5.1.4/lib/action_controller/metal/request_forgery_protection.rb:291:in `form_authenticity_token'
from /home/yechielk/.rvm/gems/ruby-2.4.2/gems/actionpack-5.1.4/lib/abstract_controller/helpers.rb:68:in `form_authenticity_token'
from /home/yechielk/.rvm/gems/ruby-2.4.2/gems/actionview-5.1.4/lib/action_view/helpers/url_helper.rb:598:in `token_tag'
from /home/yechielk/.rvm/gems/ruby-2.4.2/gems/actionview-5.1.4/lib/action_view/helpers/form_tag_helper.rb:855:in `extra_tags_for_form'
from /home/yechielk/.rvm/gems/ruby-2.4.2/gems/actionview-5.1.4/lib/action_view/helpers/form_tag_helper.rb:875:in `form_tag_html'
from /home/yechielk/.rvm/gems/ruby-2.4.2/gems/actionview-5.1.4/lib/action_view/helpers/form_helper.rb:765:in `form_with'
from /home/yechielk/Desktop/code/Personal/personal-site/app/views/admin/login.html.erb:1:in `_app_views_admin_login_html_erb___3018772792552054965_27358140'