我使用casperjs,我到了一個地步,我有這樣一個對象,以便:查詢一個getElementInfo對象CasperJS
var domElem = this.getElementInfo(".foo");
,現在我想查詢domElem進一步上,像這樣:
var domElemChild = domElem.QUERYFUNCTIONHERE(".bar");
我不能這樣做,因爲domElem是一個對象,而不是一個DOM節點,我能做些什麼(最好)只有casperjs?
注:我嘗試使用cheerio但它在努力要求其輸出以下錯誤:
Error: Cannot find module 'util'
D:/dev/myproj/phantomjs:/bootstrap.js:289
D:/dev/myproj/phantomjs:/bootstrap.js:254 in require
D:/dev/myproj/node_modules/cheerio/node_modules/htmlparser2/lib/Pars er.js:120
D:/dev/myproj/node_modules/cheerio/node_modules/htmlparser2/lib/Pars er.js:351 Unsafe JavaScript attempt to access frame with URL about:blank from frame with U RL file:///d:/casperjs/bin/bootstrap.js. Domains, protocols and ports must match