Phantomjsdriver和chromedriver(硒) [英] Phantomjsdriver and chromedriver(selenium)

查看:283
本文介绍了Phantomjsdriver和chromedriver(硒)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我使用PhantomJSDriver和ChromeDriver(Selenium)来废弃控制台应用中的数据。这是在我当地的工作,但我在服务器上添加它不工作。

你能告诉我有关< PhantomJSDriver和ChromeDriver(Selenium)?它可以在服务器上运行吗?



我尝试过:



public static void Initialize()

{



service = PhantomJSDriverService.CreateDefaultService();

Log .WriteToFile(浏览器服务创建...);





baseUrl = ConfigurationManager.AppSettings [Base_URL];

// var downloadDirectory = ConfigurationManager。 AppSettings [DownloadPath];

Log.WriteToFile(Browser init Start ...);

string path = System.IO.Path.GetDirectoryName(Assembly。 GetEntryAssembly()。Location);

FilePath = System.IO.Path.Combine(path,csv);

Log.WriteToFile(Browser path);

var chromeOptions = new PhantomJSOptions();

Log.WriteToFile(PhantomJSOptions对象);

// chromeOptions.AddUserProfilePreference(下载.default_directory,FilePath);

// chromeOptions.AddArguments(new List< string>(){headless});

// options.setBinary( /path/to/other/chrome.exe);

webDriver = new Phan tomJSDriver(chromeOptions);

Log.WriteToFile(Scrapper Start ...);



}

这是我的浏览器初始化函数

Hello,
I am using PhantomJSDriver and ChromeDriver(Selenium) to scrap the data in console app. It is work at my local but while i have added on the server it is not working.
Could you please let me know about <PhantomJSDriver and ChromeDriver(Selenium)? It can work on server or not?

What I have tried:

public static void Initialize()
{

service = PhantomJSDriverService.CreateDefaultService();
Log.WriteToFile("Browser service create...");


baseUrl = ConfigurationManager.AppSettings["Base_URL"];
// var downloadDirectory = ConfigurationManager.AppSettings["DownloadPath"];
Log.WriteToFile("Browser init Start...");
string path = System.IO.Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
FilePath = System.IO.Path.Combine(path, "csv");
Log.WriteToFile("Browser path");
var chromeOptions = new PhantomJSOptions();
Log.WriteToFile("PhantomJSOptions object");
// chromeOptions.AddUserProfilePreference("download.default_directory", FilePath);
// chromeOptions.AddArguments(new List<string>() { "headless" });
// options.setBinary("/path/to/other/chrome.exe");
webDriver = new PhantomJSDriver(chromeOptions);
Log.WriteToFile("Scrapper Start...");

}
This is my browser initialization function

推荐答案

参见< a href =https://www.codeproject.com/Questions/1234831/Scrapping-data-in-ASP-dot-NET>在ASP dot NET中抓取数据 [ ^ ]


这篇关于Phantomjsdriver和chromedriver(硒)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆