Sunteți pe pagina 1din 3

using OpenQA.

Selenium;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Support.UI;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace test
{
class Program
{
static string chrome =
System.Configuration.ConfigurationManager.AppSettings["chrome"];
static string user =
System.Configuration.ConfigurationManager.AppSettings["user"];
static string password =
System.Configuration.ConfigurationManager.AppSettings["password"];
static string url =
System.Configuration.ConfigurationManager.AppSettings["url"];

static void Main(string[] args)


{
// maine();
// Initialize the Chrome Driver
ChromeOptions c = new ChromeOptions();
using (var driver = new ChromeDriver(chrome))
// using (var driver = new
PhantomJSDriver(@"C:\Development\phantomjs-2.1.1-windows\bin"))
{
// Go to the home page
driver.Navigate().GoToUrl(url);

// Get the page elements


var userNameField = driver.FindElementById("UserName");
var userPasswordField = driver.FindElementById("Password");
var login = driver.FindElementByClassName("btn-primary");

// Type user name and password


userNameField.SendKeys(user);
userPasswordField.SendKeys(password);
// and click the login button
login.Click();
// --------------------------------------------------

driver.Navigate().GoToUrl(url + "Credit/Index/1");
System.Threading.Thread.Sleep(3000);

var idno = driver.FindElementById("IDno");


idno.SendKeys("11111111111");
var devam = driver.FindElementByClassName("btn-primary");
// driver.ExecuteScript("document.getElementsByClassName('btn-
primary').click()", new object[] { });

devam.Click();
System.Threading.Thread.Sleep(4000);
driver.FindElement(By.Id("Amount")).SendKeys("500");
driver.FindElement(By.ClassName("btn-primary")).Click();

//-----------------------------------------------------
System.Threading.Thread.Sleep(5000);
WebDriverWait webDriverWait = new WebDriverWait(driver,
TimeSpan.FromSeconds(30));
webDriverWait.Until(x => x.FindElement(By.ClassName("btn-
primary")));
devam = driver.FindElementByClassName("btn-primary");
//driver.ExecuteScript("document.getElementsByClassName('btn-
primary').click()", new object[] { });

devam.Click();

//---------------------------------------------------------
System.Threading.Thread.Sleep(5000);
webDriverWait.Until(x =>
{
try
{
x.FindElement(By.ClassName("btn-primary"));

return true;
}
catch (Exception)
{

return false;
}
}
);

driver.FindElement(By.ClassName("btn-primary")).Click();

//webDriverWait.Until(x => x.FindElement(By.Id("Amount")));

//var Amount = driver.FindElementById("Amount");


//Amount.SendKeys("1800");
//var CampaignId = driver.FindElementById("CampaignId");
//CampaignId.SendKeys("C");
//CampaignId.SendKeys("C");
//var InstallmentOptionId =
driver.FindElementById("InstallmentOptionId");
//InstallmentOptionId.SendKeys("1");
//var ProductGroupId = driver.FindElementById("ProductGroupId");
//ProductGroupId.SendKeys("C");

//driver.ExecuteScript("GSMSelect(1)", new object[] { });


//devam = driver.FindElementByClassName("btn-primary");
//// driver.ExecuteScript("document.getElementsByClassName('btn-
primary').click()", new object[] { });

//devam.Click();
//---------------------------------------------------------
System.Threading.Thread.Sleep(8000);

}
}
}
}

S-ar putea să vă placă și