NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Support;
using OpenQA.Selenium.Support.UI;
using NUnit.Framework;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Threading;


namespace PageObjectModel
{
[TestClass]
public static class ControlProperties
{
public static By clickCookies = By.Id("pgdg-continue");

public static By signupClick = By.XPath("//*[@id='ctl00_ContentMain_HyperlinkRegister']");

//public static By email = By.Name("ctl00$ContentMain$TextBoxEmail");
public static By firstName = By.Name("ctl00$ContentMain$TextBoxFirstName");
public static By lastName = By.Name("ctl00$ContentMain$TextBoxLastName");
public static By password = By.XPath("//*[@id='ctl00_ContentMain_TextBoxPassword']");
public static By confirmPassword = By.Name("ctl00$ContentMain$TextBoxPasswordConfirm");

public static By countryDropdown = By.Name("ctl00$ContentMain$DropdownListCountry");
public static By email = By.Name("ctl00$ContentMain$TextBoxEmail");
public static By zipCode = By.XPath("//*[@id='TextBoxZip']");

public static By city = By.XPath("//*[@id='TextBoxCity']");

public static By city2 = By.XPath("//*[@id='TextBoxCity']");

public static By securityAnswer = By.Id("ctl00_ContentMain_TextBoxAnswer");

public static By sendMeUpdates = By.Id("ctl00_ContentMain_CheckBoxNewsletter");
public static By iAccept = By.Name("ctl00$ContentMain$cbxIsGDPRAccepted");

public static By homeClick = By.XPath("//*[@id='ctl00_HeaderNewDesign1_HeaderMenu']/div/div/ul/li[1]/a");
public static By searchClick = By.Name("ctl00$HeaderHomeNewDesign$searchImageButton");
public static By authorSearchClick = By.Id("tabAuthorSearch");
public static By authorFirstName = By.Id("TextBoxFirstName");
public static By searchBtn = By.XPath("//*[@id='ctl00_ContentMain_PanelAuthorSearch']/input[3]");
public static By profileClick = By.XPath("//*[@id='authorSearchResult']/div/div/ul/li[1]/a/span");
public static By articlesClick = By.XPath("//*[@id='divContributes']/ul/li[1]/a");
public static By firstArticleClick = By.XPath("//*[@id='ctl00_ContentMain_contentBoxUL']/li[1]/div[2]/h3/a");
}
[TestClass]
public class PageObjectModelMethods
{
IWebDriver webDriver;


public void ClickCookies()
{
webDriver.FindElement(ControlProperties.clickCookies).Click();
WaitTime();
}

public void SignUpClick()
{

webDriver.FindElement(ControlProperties.signupClick).Click();
WaitTime();
}

public PageObjectModelMethods(IWebDriver driver)
{
this.webDriver = driver;
}



public void LastName(string userLastName)
{
webDriver.FindElement(ControlProperties.lastName).Clear();
webDriver.FindElement(ControlProperties.lastName).SendKeys(userLastName);
WaitTime();
}

public void Password(string userPassword)
{
webDriver.FindElement(ControlProperties.password).Clear();
webDriver.FindElement(ControlProperties.password).SendKeys(userPassword);
WaitTime();
}

public void ConfirmPassword(string userConfirmPassword)
{
webDriver.FindElement(ControlProperties.confirmPassword).Clear();
webDriver.FindElement(ControlProperties.confirmPassword).SendKeys(userConfirmPassword);
WaitTime();
}

public void CountryDopDown(string countryName)
{
//Thread.Sleep(3000);
IWebElement countryDrop = webDriver.FindElement(ControlProperties.countryDropdown);
countryDrop.Click();
SelectElement select = new SelectElement(countryDrop);
select.SelectByValue(countryName);
WaitTime();
}


public void ZipCode(string userZipCode)
{
webDriver.FindElement(ControlProperties.zipCode).Clear();
webDriver.FindElement(ControlProperties.zipCode).SendKeys(userZipCode);

WaitTime();
}

public void City(string userCity)
{
//Thread.Sleep(3000);
//webDriver.FindElement(ControlProperties.city).Clear();
webDriver.FindElement(ControlProperties.city).SendKeys(userCity);
//Thread.Sleep(1000);
WaitTime();
}
public void City2(string userCity2)
{

//webDriver.FindElement(ControlProperties.city).Clear();
webDriver.FindElement(ControlProperties.city2).SendKeys(userCity2);

WaitTime();
}


public void SecurityAnswer(string userSecurityAnswer)
{

webDriver.FindElement(ControlProperties.securityAnswer).Clear();
webDriver.FindElement(ControlProperties.securityAnswer).SendKeys(userSecurityAnswer);
WaitTime();
}

public void SendUpdates()
{
webDriver.FindElement(ControlProperties.sendMeUpdates).Click();
WaitTime();
}

public void IAcceptTerms()
{
webDriver.FindElement(ControlProperties.iAccept).Click();
WaitTime();
}
public void HomeClick()
{
webDriver.FindElement(ControlProperties.homeClick).Click();
WaitTime();
}

public void SearchClick()
{
webDriver.FindElement(ControlProperties.searchClick).Click();
WaitTime();
}

public void AuthorSearchClick()
{
webDriver.FindElement(ControlProperties.authorSearchClick).Click();
WaitTime();
}

public void AuthorFirstName(string userFirstName)
{
webDriver.FindElement(ControlProperties.authorFirstName).Clear();
webDriver.FindElement(ControlProperties.authorFirstName).SendKeys(userFirstName);
WaitTime();
}

public void AuthorSearchButton()
{
webDriver.FindElement(ControlProperties.searchBtn).Click();
Thread.Sleep(3000);
WaitTime();
}

public void ProfileClick()
{
webDriver.FindElement(ControlProperties.profileClick).Click();
WaitTime();
}

public void ArticlesClick()
{
webDriver.FindElement(ControlProperties.articlesClick).Click();
WaitTime();
}


public void FirstArticleClick()
{
webDriver.FindElement(ControlProperties.firstArticleClick).Click();
WaitTime();
}
public void EnterEmail(string userEmail)
{
Thread.Sleep(2000);
webDriver.FindElement(ControlProperties.email).Clear();
webDriver.FindElement(ControlProperties.email).SendKeys(userEmail);
WaitTime();
}
public void FirstName(string userFirstName)
{
webDriver.FindElement(ControlProperties.firstName).Clear();
webDriver.FindElement(ControlProperties.firstName).SendKeys(userFirstName);
WaitTime();
}
public void WaitTime()
{
WebDriverWait webDriverWait = new WebDriverWait(webDriver, TimeSpan.FromSeconds(10));
}
}

[TestClass]
public class DriverInitialization
{
IWebDriver Webdriver;


public DriverInitialization()
{
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.AddArgument("disable-infobars");
Webdriver = new ChromeDriver(@"D:chromedriver_win32", chromeOptions);
Webdriver.Navigate().GoToUrl("https://www.c-sharpcorner.com/login?returnurl=/article/c-sharp-corner-signup-page-with-page-object-model-design-pattern-in-selenium/");
Thread.Sleep(3000);
Webdriver.Manage().Window.Maximize();
WebDriverWait webDriverWait = new WebDriverWait(Webdriver, TimeSpan.FromSeconds(40));
}


[TestMethod]
public void UserRegisteration()
{
// Four User Login Data.
PageObjectModelMethods register = new PageObjectModelMethods(Webdriver);
register.ClickCookies();
register.SignUpClick();

register.EnterEmail("[email protected]");
register.FirstName("Khaja");
register.LastName("Moizuddin");
register.Password("1234567890");
register.ConfirmPassword("1234567890");

register.CountryDopDown("India");

register.ZipCode("500076");

register.City("L");
register.City2("LONDON");

register.SecurityAnswer("Valuemomentum Software Services");
register.SendUpdates();
register.IAcceptTerms();

register.HomeClick();
register.SearchClick();
register.AuthorSearchClick();
register.AuthorFirstName("Khaja");
register.AuthorSearchButton();
register.ProfileClick();
register.ArticlesClick();
register.FirstArticleClick();
//Webdriver.Quit();
}
}
}
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.