C # Use Selenium + PhantomJS in the project to simulate logon to the blog Park,
Selenium
Selenium is a web automated testing tool. Many students who learn automation have begun to prefer selenium.
PhantomJS
PhantomJS is a webkit-based javascript API. It uses QtWebKit as its core browser function and uses webkit to compile and interpret and execute JavaScript code. Anything you can do in a webkit-based browser. It is not only an invisible browser, but also provides CSS selectors, supports Web standards, DOM operations, JSON, html5, Canvas, SVG, etc, it also provides operations for processing file I/O, so that you can read and write files to the operating system. PhantomJS is widely used, such as network monitoring, Web screenshots, Web testing without a browser, and page access automation.
Official example of PhantomJS: http://phantomjs.org/examples/
C # How to use it in the project:
First install the component under Nuget
Selenium. PhantomJS. WebDriver
Selenium. WebDriver
Var url = "https://passport.cnblogs.com/user/signin"; var driver1 = new PhantomJSDriver (GetPhantomJSDriverService (); driver1.Navigate (). goToUrl (url); if (driver1.Title = "User Logon-blog Garden") {driver1.FindElement (. id ("input1 ")). sendKeys ("xielongbao"); driver1.FindElement (. id ("input2 ")). sendKeys ("1234"); driver1.FindElement (. id ("signin ")). click ();} Console. writeLine (driver1.PageSource );
Sample login code
A good package