Using system;using openqa.selenium;using openqa.selenium.chrome;namespace consoleapp_selenium{ class Program { static void Main (string[] args) { chromedriver cd = new Chromedriver ( AppDomain.CurrentDomain.BaseDirectory.ToString ()); Cd. Navigate (). Gotourl ("http://chart.icaile.com/sd11x5.php"); String text = CD. Findelementbyid ("Fixedtable"). Text; Cd. Quit (); Console.WriteLine (text); Console.read ();}}}
NuGet Installation
Find-package Selenium
Install-package Selenium.webdriver
Install-package Selenium.WebDriver.ChromeDriver
Use headless chrome so there is no interface.
Using system;using openqa.selenium.chrome;namespace consoleapp_selenium{ class program { static void Main (string[] args) { chromeoptions op = new chromeoptions (); Op. Addarguments ("--headless"); Op. Addarguments ("--window-size=1920,1080"); Chromedriver cd = new Chromedriver (AppDomain.CurrentDomain.BaseDirectory.ToString (), op); Cd. Navigate (). Gotourl ("http://chart.icaile.com/sd11x5.php"); String text = CD. Findelementbyid ("Fixedtable"). Text; Cd. Quit (); Console.WriteLine (text); Console.read ();}}}
Here is the use of PHANTOMJS
NuGet Installation > Install-package Selenium.PhantomJS.WebDriver
Using system;using openqa.selenium;using openqa.selenium.chrome;using openqa.selenium.phantomjs;namespace consoleapp_selenium{ class program { static void Main (string[] args) { phantomjsoptions po = new Phantomjsoptions (); Po. Addadditionalcapability ("Phantomjs.page.settings.userAgent", "mozilla/5.0" (Macintosh; Intel Mac OS X 10.9; rv:25.0) gecko/20100101 firefox/25.0 "); Phantomjsdriver cd = new Phantomjsdriver (AppDomain.CurrentDomain.BaseDirectory.ToString (), PO); Cd. Navigate (). Gotourl ("http://chart.icaile.com/sd11x5.php"); String text = CD. Findelementbyid ("Fixedtable"). Text; Cd. Quit (); Console.WriteLine (text); Console.read ();}}}
C # dotnetcore2.0 Search the Web with selenium