I have used VBA macros in Excel 2016 along with Chrome and Selenium WebDriver to log-in to many different websites, but I haven't been successful logging into the website shown in the following code.
' Open the "AARP" web page
WDriver.Start "chrome"
WDriver.Window.Maximize
WDriver.Get "https://www.medicare.uhc.com/AARP"
Application.Wait (Now + TimeValue("0:00:05"))
' Click the "Sign In" button
WDriver.FindElementByXPath("/html/body/div[4]/div/div[1]/div[2]/div/div/div/main/section/div/div[1]/div/button[1]").Click
' Wait until the page is fully loaded
Application.Wait (Now + TimeValue("0:00:10"))
' Login
WDriver.FindElementById("EMAIL").SendKeys ("") ' focus
WDriver.FindElementById("EMAIL").SendKeys ("abc")
Application.Wait (Now + TimeValue("0:00:02"))
WDriver.FindElementById("PASSWORD").SendKeys ("") ' focus
WDriver.FindElementById("PASSWORD").SendKeys ("123")
Application.Wait (Now + TimeValue("0:00:02"))
WDriver.FindElementById("submitBtn").Click
' Do stuff
I can see that the EMAIL address and PASSWORD are correctly inserted, but when the submit button is clicked I get the following error message from the website, "Error: The username and password combination entered does not match our records."
The source code for the EMAIL input box is
<input id="EMAIL" class="form-control ng-pristine ng-empty ng-invalid ng-invalid-required ng-touched" type="text" name="EMAIL" ng-model="sm.userInput" placeholder="" required="required" ng-blur="isValidUserNameEmail()" aria-invalid="true" style="">
The source code for the PASSWORD input box is very similar.
An acquaintance has suggested that I need to use javascript (ExecuteScript) and then call "isValidUserNameEmail()" after setting the EMAIL.
I am at a loss on how to perform this step and would appreciate help on how to code this step. Also, what exactly is the "isValidUserNameEmail()" code doing? Is there a way to accomplish this without using javascript?
Thanks in advance for your help...Ron