更新:我刚刚尝试了 capybara-webkit 驱动程序......
并做了一个puts page.html ...并得到了非常奇怪的链接
<a href="/track/adclick.php?curl=http%3A%2F%2F2586831.r.msn.com%2F%3Fld%3D8vBu5GdQd4kexMalZqHcYPmDVUCUyQANoHj2Thi7CB49kGqg45E_13jW8kWhJ3oFryF7SRaVKRasDO9OGT2j42V_4OCDVdtO0D5ZEXO9TXjg05qq0nYk4Y-APihWn7J6o43xUTn0FslIdjbT8h3cysucakxeA%26u%3Dhttp%253a%252f%252ftracker.marinsm.com%252frd%253fcid%253d529lae2415%2526mkwid%253ddPfP7vII%2526pcrid%253d3168867153%2526lp%253dhttp%25253A%25252F%25252Fwww.littlewoods.com%25252Falice-in-wonderland-blu-ray-double-play-blu-ray-dvd--includes-free-alice-in-wonderland-poster%25252F734955273.prd%253faff%253dmsn%2526affsrc%253dacquisition%2526cm_mmc%253d-_--_-Alice%252bin%252bWonderland%252bDVDs%252b%252528BMM%252529-_-%252balice%2B%252bin%2B%252bwonderland_dPfP7vII_3168867153&q=test1.tinderbox.vhost&head=%3Cb%3EAlice%3C%2Fb%3E+%3Cb%3Ein%3C%2Fb%3E+%3Cb%3EWonderland%3C%2Fb%3E+DVDs+%7C+littlewoods.com&network=yahoodm&ad_grp=TOP&ad_grp_pos=1&type=domain_query&ifc=0&host=www.littlewoods.com%2Fdvds&loadtime=1384544309" style="color:black; text-decoration:none" target="_top">Looking For DVDs with Free Returns Then Look No Further!</a>
到底是怎么回事?!我的应用程序中没有广告.. 我不会因为链接到 msn 或 yahoo 而被抓到。
我有这个:
需要“spec_helper”
功能“无需 Javascript 即可跟踪”,js: true do
before(:each) do
...
visit(
sub_domain(
path: login_view_path(
@p
),
subdomain: @account.subdomain
)
)
puts page.html
输出看起来像这样:
<html><head>
<script type="text/javascript">var NREUMQ=NREUMQ||[];NREUMQ.push(["mark","firstbyte",new Date().getTime()]);</script><title> </title>
<script type="text/javascript">
function bredir(a, b, c, d, e, ldr, ifc) {
var h, i, j;
var f = 0;
var g = 0;
var k = false;
var l = false;
var m = [
[300, 250, false],
[250, 250, false],
[240, 400, false],
[336, 280, false],
[180, 150, false],
[468, 60, false],
[234, 60, false],
[88, 31, false],
[120, 90, false],
[120, 60, false],
[120, 240, false],
[125, 125, false],
[728, 90, false],
[160, 600, false],
[120, 600, false],
[300, 600, false],
[300, 125, false],
[530, 300, false],
[190, 200, false],
[470, 250, false],
[720, 300, true],
[500, 350, true],
[550, 480, true],
//YouTube:
[560, 315, true],
[640, 360, true],
[853, 480, true],
[1280, 720, true],
//Vimeo:
[400, 300, true],
[500, 281, true],
//Hulu:
[480, 270, true],
[512, 288, true],
//metacafe:
[440, 248, true],
[460, 284, true],
[540, 304, true],
[600, 338, true],
//Other dimensions (metacafe, myspace video, yahoo video, break.com, ustream, vevo, justin.tv, etc):
[210, 120, true],
[400, 300, true],
[425, 350, true],
[425, 360, true],
[435, 251, true],
[435, 271, true],
[500, 300, true],
[525, 295, true],
[575, 324, true],
[620, 389, true],
[624, 351, true],
[630, 381, true],
[640, 385, true],
[650, 368, true],
[1000, 562, true],
[1000, 563, true],
[1000, 564, true]
];
if (typeof window.innerHeight == "number") {
g = window.innerHeight;
f = window.innerWidth;
} else if (typeof document.body.offsetHeight == "number") {
g = document.body.offsetHeight;
f = document.body.offsetWidth;
}
for (var n = 0; n < m.length; n++) {
j = m[n];
h = Math.abs(f - j[0]);
i = Math.abs(g - j[1]);
if (top != self) {
ifc = 1;
} else {
ifc = 0;
};
if (h <= 2 && i <= 2) {
k = true;
l = j[2]
}
}
if(f === 0 && g === 0){
return;
}
if ((a != "www.facebook.com" && a != "platform.twitter.com") && (k || f < 100 && f !== 0 || g < 100 && g !== 0)) {
if (l && self == parent) {
return;
}
return "/b" + "anner.php?w=" + f + "&h=" + g + "&d=" + a + "&url=" + b + "&ref=" + c + "&view=" + d
} else if ((a == "www.facebook.com" || a == "platform.twitter.com") && (f >= 250 && g >= 60) && (k || f < 100 && f !== 0 || g < 100 && g !== 0)) {
if (l && self == parent) {
return;
}
return e + "&w=" + f + "&h=" + g + "&ldr=" + "b" + "&ifc=" + ifc;
} else if ((a == "www.facebook.com" || a == "platform.twitter.com") && (f < 250 || g < 60) && (k || f < 100 && f !== 0 || g < 100 && g !== 0)) {
if (l && self == parent) {
return;
}
return "/b" + "anner.php?w=" + f + "&h=" + g + "&d=" + a + "&url=" + b + "&ref=" + c + "&view=" + d;
} else {
return e + "&w=" + f + "&h=" + g + "&ifc=" + ifc;
}
}
function bdetect() {
var loc = bredir(
'test1.tinderbox.vhost',
'test1.tinderbox.vhost%2Fview%2Falice-in-wonderland-14-years-later%2Flogin',
'',
'error',
'/main?wc=EWJvEwFmDRpfAhxuAA%3D%3D&url=test1.tinderbox.vhost%2Fview%2Falice-in-wonderland-14-years-later%2Flogin'
);
if(typeof loc === 'undefined') {
self.close();
return;
}
location.replace(loc);
}
</script>
</head>
<body onload="bdetect()" style="margin: 0px;">
<noscript>
<iframe frameborder="0" src="/main?wc=EWJvEwFmDRpfAhxuAA%3D%3D&amp;url=test1.tinderbox.vhost%2Fview%2Falice-in-wonderland-14-years-later%2Flogin" width="100%" height="100%"></iframe>
</noscript>
<script type="text/javascript">if(!NREUMQ.f){NREUMQ.f=function(){NREUMQ.push(["load",new Date().getTime()]);var e=document.createElement("script");e.type="text/javascript";e.src=(("http:"===document.location.protocol)?"http:":"https:")+"//"+"js-agent.newrelic.com/nr-100.js";document.body.appendChild(e);if(NREUMQ.a)NREUMQ.a();};NREUMQ.a=window.onload;window.onload=NREUMQ.f;};NREUMQ.push(["nrfj","beacon-6.newrelic.com","01957cb5b6","2615933","YlxaMhZTCERSUUwIClsWbRQNHQ9ZV1dATxVdSQ==",0,4,new Date().getTime(),"","","","",""]);</script>
<script type="text/javascript" src="http://js-agent.newrelic.com/nr-100.js"></script></body></html>
这是什么?为什么会这样?
Capybara::ElementNotFound
当我尝试使用它时fill_in