我正在cheerio和一些人一起努力nightmare.我之所以使用这两者并不仅仅是cheerio因为我必须操纵网站才能找到我想要抓到的部分而且我发现噩梦非常擅长做这些脚本.
所以,现在我正在使用nightmare直到显示我需要的信息的部分.在那之后,evaluate()我试图以某种方式返回电流html然后传递给cheerio刮板.问题是我不知道如何从document对象中检索html .是否有一个属性从那document返回全身?
这是我正在尝试做的事情:
var Nightmare = require('nightmare');
var nightmare = Nightmare({show:true})
var express = require('express');
var fs = require('fs');
var request = require('request');
var cheerio = require('cheerio');
var app = express();
var urlWeb = "url";
var selectCity = "#ddl_city"
nightmare
.goto(urlWeb)
.wait(selectCity)
.select('#ddl_city', '19')
.wait(6000)
.select('#ddl_theater', '12')
.wait(1000)
.click('#btn_enter')
.wait('#aspnetForm')
.evaluate(function(){
//here is where I want to return the html body …Run Code Online (Sandbox Code Playgroud) 我目前正在尝试使用 Selenium WebDriver (JAVA) 2.53 和 Firefox 43.0 执行 TOR 6.0.4。我已按照这篇文章《Using Selenium WebDriver with Tor》中的说明进行操作,但在将 TOR 的 profilePath 加载到 Firefox 二进制文件时遇到错误。我已经看到可以通过将 TOR profile.default 存档加载到 firefox binaty 来午餐 TOR,但在使用配置文件实例化二进制文件时,我得到了驱动程序信息:driver.version:未知。我已经尝试更换firefox版本了,还是不行。在我启动驱动程序的代码下面。我也在使用Windows。
String torPath = "C:\\Users\\Jose Bernhardt\\Desktop\\Tor Browser\\Start Tor Browser.exe";
String profilePath = "C:\\Users\\Jose Bernhardt\\Desktop\\Tor Browser\\Browser\\TorBrowser\\Data\\Browser\\profile.default";
File torProfileDir = new File(profilePath);
FirefoxBinary binary = new FirefoxBinary(new File(torPath));
FirefoxProfile torProfile = new FirefoxProfile(torProfileDir);
FirefoxDriver driver = new FirefoxDriver();
driver.get("http://www.google.com/webhp?complete=1&hl=en");
Run Code Online (Sandbox Code Playgroud)
请参阅下面抛出的异常:
Exception in thread "main" org.openqa.selenium.WebDriverException: Specified firefox binary location does not exist or …Run Code Online (Sandbox Code Playgroud)