- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
基本上,我想重复加载一个 URL,比如 http://xyz.co.in然后检查特定元素的值,就像测试过程一样并监视该流的服务器日志。
我试图通过重复访问同一主机来进行进一步处理来模拟一部分生产流量。我怎样才能最好地解决这个问题?
流
加载网页 -> 监控服务器日志 -> 在前端监控某些元素值 -> 再次重复。
最佳答案
Greasemonkey 不是 load testing 的最佳工具网页/服务器/应用程序。
但是这里有一个重复加载页面并检查元素的脚本:
// ==UserScript==
// @include http://xyz.co.in/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js
// ==/UserScript==
$(document).ready (Greasemonkey_main);
function Greasemonkey_main ()
{
do
{
var TargetNode = $("#TargetNode"); //-- Look for node with id, "TargetNode".
if (TargetNode && TargetNode.length)
{
//--- Maybe also check contents:
if (/Node contents to search for/i.test (TargetNode.text () ) )
{
alert ("We found what we're looking for");
break;
}
}
//--- Failsafe check on number of reloads
var NumReloads = parseInt (document.location.search.replace (/.*num_gm_reloads=(\d+).*/, "$1") )
if (NumReloads > 2)
{
alert ("After 2 reloads, we still didn't find what we were looking for.");
break;
}
//--- We neither found the stop code nor exhausted our retries, so reload the page.
if (NumReloads)
NumReloads++;
else
NumReloads = 1;
var TargetURL = window.location.href;
//--- Strip old URL param, if any. Note that it will always be at the end.
TargetURL = TargetURL.replace ( /(.*?)(?:\?|&)?num_gm_reloads=\d+(.*)/, "$1$2" );
var ParamSep = /\?/.test (TargetURL) ? "&" : "?";
TargetURL = TargetURL + ParamSep + 'num_gm_reloads=' + NumReloads;
window.location.href = TargetURL; //-- Reload the page.
} while (0)
}
关于html - 如何使用 grease-monkey 重复加载网页并检查元素?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4778586/
为了方便起见,我想在我的 IDE IntelliJ 中编辑一些我正在处理的用户脚本,作为一个更大项目的一部分。我喜欢在一个项目中把所有东西都放在一起。我遇到的一个小问题是,如果我想从 IntelliJ
我有点卡住了。我正在尝试创建一个 Grease Monkey 脚本,该脚本将自动单击拍卖网站上出现的弹出窗口。我有 Xpat,但我对 GM 的经验太丰富了,无法让它工作。 这是我从 fire find
基本上,我想重复加载一个 URL,比如 http://xyz.co.in然后检查特定元素的值,就像测试过程一样并监视该流的服务器日志。 我试图通过重复访问同一主机来进行进一步处理来模拟一部分生产流量。
我经常访问一个以可怕的方式忽略用户的论坛。如果您将某人置于忽略状态,这几乎会使该用户的存在更加普遍。 所以我写这个来完全隐藏它们: // ==UserScript== // @name
首先,如果我在这里的术语不是最准确的,我深表歉意;在编程方面,我是一个新手。我常去的一个论坛在页面上添加了一堆不必要的、“有问题的”图像和文本作为某种宣传的一部分,但结果是该论坛现在很难使用和阅读。我
我是一名优秀的程序员,十分优秀!