private string ExecuteCommand(string url)
{
try
{
using (var phantom = new PhantomJSDriver())
{
var indexFile = Server.MapPath("~/Scripts/PhantomJS/index.js");
var scriptSource = System.IO.File.ReadAllText(indexFile);
var script = phantom.ExecutePhantomJS(scriptSource);
phantom.Navigate().GoToUrl("https://www.bing.com");
phantom.FindElement(By.Id("sb_form_q")).SendKeys("learn2automate");
//Click on Search
phantom.FindElement(By.Id("sb_form_go")).Click();
Screenshot sh = phantom.GetScreenshot();
sh.SaveAsFile(@"C:\Temp.jpg", ImageFormat.Png);
phantom.Quit();
}
}
catch (Exception ex)
{
}
return string.Empty;
}