+ Reply to Thread
Results 1 to 19 of 19

Completing a webform with VBA

  1. #1
    Forum Contributor
    Join Date
    04-12-2013
    Location
    Usually at work, in the UK
    MS-Off Ver
    Excel 2010
    Posts
    639

    Completing a webform with VBA

    I am attempting to work out how to complete a web form on www.Airbnb.com, specifically the "Log In" section using my email and password.

    I know how to call the IE object for the website but am having trouble trying to select the Log in hyperlink so it can be completed. Can anyone advise how this can be done please as the webdesign doesn't conform with anything I am reading online

    I think Set Allhyperlinks = IE.Document.GetElementsByTagName("A") is the bit to change but can't work out what to change it to.

    Any advice would be appreciated.

    Please Login or Register  to view this content.
    Last edited by Sc0tt1e; 05-17-2017 at 02:12 PM.

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Completing a webform with VBA

    This opens the log-in page, but it will not help you much.

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    04-12-2013
    Location
    Usually at work, in the UK
    MS-Off Ver
    Excel 2010
    Posts
    639

    Re: Completing a webform with VBA

    You're a star, that works
    Now I see I don't need READYSTATE3 and the Call IE.Document.GetElementsById("(email)") & ("(password)") don't work and I'm guessing it's because I should be using a different element to ID but I have tried them all and it won't call.

    Any ideas?

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Completing a webform with VBA

    Tyr this one, but you might get an error on click as I am not sure if it works.
    You need to change user name and password to actual log-in details

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    04-12-2013
    Location
    Usually at work, in the UK
    MS-Off Ver
    Excel 2010
    Posts
    639

    Re: Completing a webform with VBA

    It's missing the .value on signin_email without that the email address isn't entered.

    Also if I run the code either the log in page isn't created or it is and the email address and password don't populate but if I step through the code it does, why is that????

    Also error message runtime 462 populates on the user login button?

  6. #6
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Completing a webform with VBA

    With the password and username you have, I managed to get these values in to the text boxes, but it did not log-in. Step over using F8, and before the code reaches the click line, you can check the site and see for yourself.

  7. #7
    Forum Contributor
    Join Date
    04-12-2013
    Location
    Usually at work, in the UK
    MS-Off Ver
    Excel 2010
    Posts
    639

    Re: Completing a webform with VBA

    As I said, if I step through the code it works, if I run it it doesn't.

    The code for the email and password is run before the log in page is created as such there is no object for the email value to populate

  8. #8
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Completing a webform with VBA

    It is probably the code is trying to populate the details before the page is fully loaded.
    You can add a wait function and change the wait event.

    While IE.readyState <> 4: DoEvents: Wend

    Set doc = IE.document

    Application.Wait (Now + TimeValue("0:00:05"))

  9. #9
    Forum Contributor
    Join Date
    04-12-2013
    Location
    Usually at work, in the UK
    MS-Off Ver
    Excel 2010
    Posts
    639

    Re: Completing a webform with VBA

    isn't that what the below bit of the code is doing?

    Please Login or Register  to view this content.
    When I change to your code it now says there is no object for the email value to populate?
    Last edited by Sc0tt1e; 05-17-2017 at 05:23 PM.

  10. #10
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Completing a webform with VBA

    I am confused what is working or not working. I can not test it, as I do not have the right to access the site.
    If the code works using F8, but does not work when you run it, I can only assume that there has to be a time lag between the first session and the second.


    Please Login or Register  to view this content.

  11. #11
    Forum Contributor
    Join Date
    04-12-2013
    Location
    Usually at work, in the UK
    MS-Off Ver
    Excel 2010
    Posts
    639

    Re: Completing a webform with VBA

    Correct, that was the problem

    You suggested the wait code which I have added and which loads the page before the macro can run again but now I have added the wait it produces an error message where there wasn't one before (I have not signed up for this site yet I am testing to see if I can log in before doing so as this is just stage 1 of a multi stage macro)

    The red line is where I get the error, I have added a screen print so you can see what I am seeing when the error occurs

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by Sc0tt1e; 05-17-2017 at 05:38 PM.

  12. #12
    Forum Contributor
    Join Date
    04-12-2013
    Location
    Usually at work, in the UK
    MS-Off Ver
    Excel 2010
    Posts
    639

    Re: Completing a webform with VBA

    I'm not sure how this happened but the ID names for the email and password fields has changed (see code which now works up to the log in button which has now also changed (under a span tag??) and I do not know how to refer to this now. If anyone (AB33 if you're not too tired of this yet) can advise I would be greatly appreciative?

    Please Login or Register  to view this content.

  13. #13
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Completing a webform with VBA

    I do not know.
    I have tried both of these, but the e-mail box does not seem to accept any of these.

    Please Login or Register  to view this content.

  14. #14
    Forum Contributor
    Join Date
    04-12-2013
    Location
    Usually at work, in the UK
    MS-Off Ver
    Excel 2010
    Posts
    639

    Re: Completing a webform with VBA

    see my last post, these two fields are now working as I have changed the ("...") part of the code
    Please Login or Register  to view this content.
    It is the userbutton.click part of the code below that now does not work
    Please Login or Register  to view this content.

  15. #15
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Completing a webform with VBA

    No, I have got an error on

    Please Login or Register  to view this content.

  16. #16
    Forum Contributor
    Join Date
    04-12-2013
    Location
    Usually at work, in the UK
    MS-Off Ver
    Excel 2010
    Posts
    639

    Re: Completing a webform with VBA

    I have included the document and all it's code so it can be run and it allows me to populate the fields email and password fields.

    I did notice that the names seemed to changed (from email to email-login-email) after the assistance provided by you earlier in the day when you provided the id names.
    Attached Files Attached Files
    Last edited by Sc0tt1e; 05-18-2017 at 05:02 AM.

  17. #17
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Completing a webform with VBA

    Well, I am still getting error on the password line using the attached code, but if you manage to get in to the password and username, but click button is not working, you could try a "Submit" instead of click.
    I have the feeling that you can not automate using IE. I think it is done on purpose not to allow auto completion.

  18. #18
    Forum Contributor
    Join Date
    04-12-2013
    Location
    Usually at work, in the UK
    MS-Off Ver
    Excel 2010
    Posts
    639

    Re: Completing a webform with VBA

    submit doesn't work, anyone any idea how I can get the submit button working?

  19. #19
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Completing a webform with VBA

    I do not think the site accept automation. I even looked at alternative way of getting around the log-in details.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Filling Webform via VBA
    By Fettertiger in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-25-2016, 12:13 PM
  2. VBA to enter value to webform
    By nikbakti in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-22-2016, 10:16 AM
  3. How do I submit a webform from VB/VBA?
    By itselflearn in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-27-2013, 05:24 PM
  4. Retrieving information from a webform
    By spartan81 in forum Excel General
    Replies: 1
    Last Post: 02-09-2011, 05:18 AM
  5. from worksheet to webform
    By abelisk_v in forum Excel General
    Replies: 1
    Last Post: 08-07-2007, 01:17 PM
  6. [SOLVED] Input data to webform
    By mpeplow in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-31-2006, 07:50 PM
  7. Webform
    By Archie in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-13-2006, 02:50 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1