问题描述
|
我已经在拍卖网站上了解了这种当前情况。
Trada.net Somtimes有时会脱机几个小时,当前的位置是:脱机位置,现在,它基本上禁用了我所有其他的GM脚本,导致没有数据可分析,并且位置错误。现在,我该如何投放一个脚本来检查当前位置是否为“离线”位置,如果为true,请单击名为“ Live Auctions”的网站上的按钮,其xpath为:每5分钟
.//*[@id=\'art-main\']/div[1]/div[10]/div[2]/div/div[1]/ul/span[1]/li/a/span[3]
,或任何时间范围。我需要执行时间表部分,但是找到链接或按钮仍然是一个问题,然后找到我当前的位置是我的另一个障碍。
谢谢
解决方法
假设脚本为ѭ1触发,则应执行类似的操作。 :
//--- Is this the offline page?
if (/errorPage/i.test (window.location.href) )
{
//--- Wait 5 minutes and try the main page again.
var timeDelay = 5 * 60 * 1000; //-- 5 min,in milliseconds.
setTimeout (function() {
//--- Get \"button\" target. Nominally,http://www.trada.net/p_home.aspx
var desiredPage = $(\'div#art-main div.art-nav ul.art-menu span li a.active\')[0].href;
window.location.replace (desiredPage);
},timeDelay);
return; //-- Don\'t process the rest of the script since we are not yet on target page(s).
}
请注意,您可能只需要跳过desiredPage
部分并使用:
window.location.replace (\'http://www.trada.net/p_home.aspx\');