Unable to log in with Selenium webdriver but able to log in Manually.. PLEASE HELP !

43 views
Skip to first unread message

sra...@madisonpg.com

unread,
Apr 16, 2016, 6:06:34 AM4/16/16
to Selenium Users
Hi all, 

i am using Selenium Webdriver within Visual Studio and using C# programming Language. 

So i created a script to enter user name password and then select log in. ( it does all of that ) but it wont log me in instead it tells me it received a bad request. 

I am trying to log into Microsoft 365. So here is the code Below 

 [TestMethod]
        public void login()
        {
            NavigationHelper.NavigateToURL(ObjectRepository.Config.GetWebsite());
            

            IWebElement login = ObjectRepository.Driver.FindElement(By.Id("cred_userid_inputtext"));
            
            login.SendKeys("User001");
            login = ObjectRepository.Driver.FindElement(By.Id("cred_password_inputtext"));
             login.SendKeys("Pass");
           

            login = ObjectRepository.Driver.FindElement(By.Id("cred_sign_in_button"));
            login.SendKeys(Keys.Return);

}

i Tried to put wait times but it did not work. am not sure WHY this is happening. Maybe a javascript load issue ? 
Can someone please help me with this syntax if it is invalid. 

However as i mentioned earlier when i open the browser and enter the same Credentials it logs me in just fine. 

Thank YOU ! 

saurabh verma

unread,
Apr 16, 2016, 6:21:00 AM4/16/16
to seleniu...@googlegroups.com
try 
login = ObjectRepository.Driver.FindElement(By.Id("cred_sign_in_button"));
            login.Click();




Greetings,
SaurabhV
9665987601

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/cebd75b5-7948-4b79-a985-875bbbee650d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages