bishop kumar

bishop kumar

  • 1.7k
  • 109
  • 209

how can webapi make scrapped?

Feb 5 2019 4:44 AM
automation web api easy make resouces and sample format 
 
ChromeDriverService service = ChromeDriverService.CreateDefaultService();
// service.HideCommandPromptWindow = true;
var options = new ChromeOptions();
//options.AddArgument("--window-position=-32000,-32000");
var driver = new ChromeDriver(service, options);
driver.Navigate().GoToUrl("https://www.e-m.com/portal/Partner/login.aspx");
IWebElement query = driver.FindElement(By.Id("HomeContentPlaceHolder_txtLoginID"));
query = driver.FindElement(By.Id("HomeContentPlaceHolder_txtLoginID"));
query.SendKeys("xxxxxx");
query = driver.FindElement(By.Id("HomeContentPlaceHolder_txtPassword"));
query.SendKeys("yyyyyy");
driver.FindElement(By.XPath("//*[@id='HomeContentPlaceHolder_ckTermAndCon']")).Click();
driver.FindElement(By.Id("HomeContentPlaceHolder_btnSubmit")).Click();
driver.Navigate().GoToUrl("https://www.e-mudhra.com/portal/Partner/Reports/ApplicationProcessed.aspx");
query = driver.FindElement(By.Id("txtFromDate"));
query.SendKeys(emudra_date);
driver.FindElement(By.XPath("//*[@id='ui-datepicker-div']/div/div/select[1]/option[" + month + "]")).Click();
driver.FindElement(By.XPath("//*[@id='ui-datepicker-div']/div/div/select[2]/option[" + year + "]")).Click();
int milliseconds = 5000;
Thread.Sleep(milliseconds);
driver.FindElement(By.XPath("//*[@id='ui-datepicker-div']/table/tbody/tr[2]/td[1]/a")).Click();
driver.FindElement(By.Id("btnSearch")).Click();
milliseconds = 10000;
var click2 = driver.FindElementById("downloadLink").GetAttribute("href");//.Document.GetElementsByTagName("a");
var response =(new WebClient().DownloadString(click2));
//byte[] dddd = File.ReadAllBytes(click2);
Thread.Sleep(milliseconds);
driver.FindElement(By.Id("downloadLink")).Click();
 

Answers (2)