1

I am trying to login to a webpage using VBA, but I am unable to get it done. The issue is after the username and password punched, when clicking the signin button the webpage gives an error as "Required field" so basically the credentials are not entered.

I have also tried to set the value to the attribute using IE.document.getElementById("email").setAttribute("Value") = "XX" but still is throws the same error. I have also tried .focus method too but no luck.

I hope I have explained my issue, kindly excuse for any errors. The webpage link "" https://dashboard.stripe.com/login"" I cannot share the credentials as it is confidential."

Set IE = CreateObject("InternetExplorer.application")

IE.Visible = True
IE.navigate "https://dashboard.stripe.com/login"
Do Until Not IE.busy: DoEvents: Loop
Set doc = IE.document
Do While doc.ReadyState <> "complete": DoEvents: Loop

IE.document.getelementbyid("email").Value = "[email protected]"
IE.document.getelementbyid("password").Value = "a"

Set ElementCol = IE.document.getElementsByTagName("span")
For Each link In ElementCol
If link.innerHTML = "Sign in to your account" Then
link.Click
End If
Next
4
  • I hit a recaptcha to prove not a robot when attempting login. Are you sure "scraping" is allowed? Commented Jul 29, 2018 at 9:09
  • And even if is, I think the captcha is going to be a difficult obstacle to overcome. Certainly not with VBA. Commented Jul 29, 2018 at 9:20
  • I think it is.The captcha will popup only once after a successful login on the same system it will not. Are you able to enter the credentials and hit sigin? Commented Jul 29, 2018 at 9:42
  • Hi QHarr, could you please post code you used with Selenium. Commented Jul 29, 2018 at 12:33

1 Answer 1

1

I did the following with selenium basic. After install go to VBE > Tools > References > Add reference to selenium type library.

Option Explicit
Public Sub EnterInfo()
    Dim d As WebDriver, keys As New Selenium.keys
    Set d = New ChromeDriver
    Const url = "https://dashboard.stripe.com/login"
    With d
        .AddArgument "--headless"
        .Start "Chrome"
        .get url
         .FindElementById("email").SendKeys "[email protected]"
         .FindElementById("password").SendKeys keys.Enter
        .FindElementById("password").SendKeys "password"
        .FindElementById("password").SendKeys keys.Enter
         .FindElementByTag("form").submit
         Stop '<== Delete me
        '.Quit
    End With
End Sub
Sign up to request clarification or add additional context in comments.

9 Comments

Thanks for the help however I have not worked with Selenium so it will be hard for me too move further as I have to get information from the web page after login and navigate to different options to get the information.
Hi QHarr, I tried the above code but it gives me an error after I start the web browser.(The underlying connection was closed an unexpected error occurred on a receive) So I changed the browser to IE it works. Also you are correct the captcha seems to be a problem as it shows each and every time I login. Do you have any solution?
Thanks for your help. Do you have any solution for the error.
Hi QHarr, it has been a while. I had solved the captcha issue. Now the problem is I need to select the drop-down to change accounts, but I am unable to do it. Any help is appreciated
Please post your solution for the captcha that will be useful for future readers. If you post a new question for the current problem and include the URL/HTML (as insert using snippet tool not image) and drop me a line here I would love to help.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.