Selenium.PhantomJS is invalid namespace

独自空忆成欢 提交于 2019-12-31 00:41:08

问题


I am really trying my best to find a way to web scrape a website using javascript to load the pages so I can scrape lets say my playlist for example. I have had no luck with chrome driver nor phantomjs. Please have a look below and see if you can help me with the error.

using OpenQA.Selenium;
//The type or namespace 'PhantomJS' does not exist in the namespace 'OpenQASelenium'
using OpenQA.Selenium.PhantomJS;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


namespace MusicScaper
{
    class TidalScraper
    {
    }
}

My packages.config file is as follows:

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="HtmlAgilityPack" version="1.8.7" targetFramework="net461" />
  <package id="PhantomJS" version="2.1.1" targetFramework="net461" />
  <package id="Selenium.Support" version="3.14.0" targetFramework="net461" />
  <package id="Selenium.WebDriver" version="3.14.0" targetFramework="net461" />
</packages>

回答1:


The .NET language bindings marked the PhantomJS driver classes deprecated in 3.11, and those classes were removed in 3.14. The PhantomJS project and its driver are no longer being maintained, and the driver code has not (and will not) be updated to support the W3C WebDriver Specification. The preferred “headless” solution is to use Chrome or Firefox in headless mode, as both of those browsers and their drivers support such an operating mode. Alternatively, if you have your heart set on PhantomJS, and you don’t care about cross-browser execution, you can simply use the PhantomJS executable and automate it through its internal JavaScript API.



来源:https://stackoverflow.com/questions/52442100/selenium-phantomjs-is-invalid-namespace

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!