- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
greasemonkey 的这个脚本对我有用,当加载某个网站时单击按钮。
但是如何设置等待时间呢?示例:网站已加载,脚本等待 1 秒直到执行。
我的第二个问题是:如何在每次加载页面时只运行一次?脚本一遍又一遍地开始。
// ==UserScript==
// @name _YOUR_NAME
// @include http://YOUR_SERVER.COM/YOUR_PATH/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @grant GM_addStyle
// ==/UserScript==
/*- The @grant directive is needed to work around a design change
introduced in GM 1.0. It restores the sandbox.
*/
function clickSubmitBtnWhenItAppears (jNode) {
var clickEvent = document.createEvent ('MouseEvents');
clickEvent.initEvent ('click', true, true);
jNode[0].dispatchEvent (clickEvent);
}
//-- Value match is case-sensitive
waitForKeyElements (
//"#btn_submit input[type='submit'][value*='Click Me Now']",
"input[type='submit'][value*='Click Me Now']",
clickSubmitBtnWhenItAppears
);
脚本来源:How do I get Greasemonkey to click on a button that only appears after a delay?
最佳答案
这可能是您正在寻找的:
$(document).ready(function() { //When document has loaded
setTimeout(function() {
//Code to run After timeout elapses
}, 2000); //Two seconds will elapse and Code will execute.
});
关于javascript - 设置等待时间,延迟时间,执行脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32537330/
假设我们有 MethodA 和 MethodB,其中整个方法的主体都在单个大锁 block 中。两种方法都使用相同的对象进行锁定: lock (objectX) { // methodbody
我想在我的代码中设置不同的 Capybara 等待时间,具体取决于它们通常需要多长时间才能完全加载?我是否必须重复更改 Capybara.default_wait_time 还是有更好的方法? 最佳答
我们的 Graphite 服务器面临 CPU 和磁盘瓶颈。主要问题是 %IO 等待时间始终在 40% 的范围内。我们在具有 7.5 GiB RAM 的 RHEL 服务器上的 2 核 CPU 上运行它。
我正在编写一个自动化测试程序,它将测试一些有时加载某些 AJAX 调用很慢的 Web 程序。例如,用户将单击“查询”,这将导致 15 到 90 秒的 HTML“加载”覆盖。搜索完成后,它将使用结果更新
如果我使用例如“ls -Rlah/”运行以下函数“运行”,我会按预期通过打印语句立即获得输出 import subprocess32 as subprocess def run(command):
如何检查 Linux 机器中进程等待 CPU 的时间? 例如,在加载的系统中我想检查 SQL*Loader 有多长(sqlldr) 进程等待。 如果有一个命令行工具来执行此操作将会很有用。 最佳答案
我正在运行一个多并行文件处理进程(最少 200 个进程),其中每个进程正在读取不同大小(0-50mb)的日志以捕获日志的实时数据。我在 16 个内核上运行我的作业和 8 GB 内存 Linux 机器。
我可以使用哪个 C API 来获取 Linux 上退出的子进程的总磁盘 IO 等待时间(绝对值)? 例如PID 为 1234 的进程运行了 10 秒,并等待 IO 操作完成 3 秒。 背景:我试图找出
我需要一些帮助来计算 bash 脚本的平均 IO 等待时间。 我要运行的脚本非常简单。排序 2 个文件,然后加入。因为我将在大文件上进行测试,所以我需要知道我有多少 IO 瓶颈才能做出一些决定(加入哪
我们在 UNIX 中使用 iostat 在 Unix 中获取所有这些信息。我可以在 Windows 中执行此操作。目前我们使用 typeperf。 最佳答案 还有一个实用程序“logman”。有关此主
我们的 Web 应用程序在高峰时段遇到性能问题,目前该应用程序分为一台 2003 IIS6 Web 服务器和一台 SQL Server 2005 DB 服务器。数据库服务器上的查询时间看起来不错(大约
我是一名优秀的程序员,十分优秀!