1
我想湊一個頁面phantomjs作品。清單必須與選項進行過濾,所以一些點擊參與。phantomjs點擊一個環節而不是另一個在同一頁
這裏是我的代碼:
var page = require('webpage').create();
page.viewportSize = { width: 1024, height: 768 };
page.open('http://jobs.bdjobs.com/jobsearch.asp?fcatId=1&icatId=', function() {
var coords = page.evaluate(function() {
var firstlink = document.querySelectorAll('a.dropdown-toggle')[0];
return {x: firstlink.offsetLeft, y: firstlink.offsetTop};
});
page.sendEvent('click', coords.x + 1, coords.y + 1);
page.onConsoleMessage = function(msg) {console.log(msg);}
page.render('bdjobs.png');
phantom.exit();
});
輸出類似於 this
即使關鍵詞菜單應該已經觸發,事實並非如此。
我敢肯定,代碼工作,因爲當我點擊鏈接頁面的頂部,我可以在他們已經被點擊截圖中看到。
這裏的page link
我在做什麼錯?