So, the scenario is to login to said website using a formatted url, rather than doing something like what is below. Upon reading documentation regarding Selenium etc i read that this is bad practice (Excluding a login test case). I understand that the method i am inquiring about is not to be used on production level.
Does the url method pull the login information from a database?
//ENTER AGENT LOGIN ID
IWebElement LoadAgentLoginID2 = selenium.FindElement(By.Id("MainContent_txtAgentID"));
LoadAgentLoginID2.Click();
LoadAgentLoginID2.SendKeys(AgentLoginIDs[0]);
//ENTER ARC NUMBER
IWebElement LoadARCnumber2 = selenium.FindElement(By.Id("MainContent_txtArcNbr"));
LoadARCnumber2.Click();
LoadARCnumber2.SendKeys(System.String.Format("{0}", ARCnumbers[1]));
//ENTER PASSWORD
IWebElement LoadPassword2 = selenium.FindElement(By.Id("MainContent_txtPassword"));
LoadPassword2.Click();
LoadPassword2.SendKeys(AgentPasswords[0]);
Any help is greatly appreciated. Cheers!
The url method needs to be supported by the web application. If this is supported, then it would simply be something like this:
driver.get(“http://www.mywebapp.com?username=JohnP&password=ABCD”);
If the web app does not support this, then you should just try to encapsulate your login logic above into a separate and reusable method.