08-27-周三_17-09-29

This commit is contained in:
2025-08-27 17:10:05 +08:00
commit 86df397d8f
12735 changed files with 1145479 additions and 0 deletions

26
node_modules/phantom/samples/test_phantom_5.coffee generated vendored Normal file
View File

@@ -0,0 +1,26 @@
# Success: Working model on using PhantonJS to get results from pages
phantom = require 'phantom'
# Creates one process
phantom.create (ph) ->
# Creates on page
ph.createPage (page) ->
page.open "http://www.deal.com.sg/deals/singapore", (status) ->
console.log "opened page? ", status
someFunc = (aaa, my_obj) ->
attribute_to_want = aaa
h2Arr = []
results = document.querySelectorAll(attribute_to_want)
for x in [0...results.length]
h2Arr.push(results[x].src)
return {
h2: h2Arr
aaa: this.arguments
obj: my_obj
}
finishedFunc = (result) ->
console.log result
ph.exit()
page.evaluate someFunc, finishedFunc, '#deal-main-pic img', {wahtt: 111}