Results 1 to 1 of 1

VBA to Click Web Page Button without ID/Name

Threaded View

king05 VBA to Click Web Page Button... 04-03-2022, 11:38 AM
  1. #1
    Registered User
    Join Date
    04-27-2016
    Location
    Philippines
    MS-Off Ver
    MS Office 2016
    Posts
    28

    VBA to Click Web Page Button without ID/Name

    Hello,

    I'm trying to programmatically upload a file on my own FTP account using the code below. I somehow managed to fill up the login page and click the login button but, I cannot click the upload button by similar code for clicking the upload button.
    Is there anyone who can help me with this?

    Best Regards and thanks in advance.

    Here's the HTML content of the webpage after successfully logging in.
    HTML Code: 


    I'm trying to programmatically click the Upload button but cannot find the elements to be used.
    Sub FTPUpload()
    
    Set IE = CreateObject("InternetExplorer.application")
    IE.Visible = True
    strURL = "http://www.txftp.com/index.php"
    IE.Navigate strURL
    
    Do While IE.Busy
        Application.Wait DateAdd("s", 1, Now)
    Loop
    
    'Fill-up login page
    Set doc = IE.Document
    doc.getElementsByClassName("form-text")(0).Value = "123.45.678.90"
    doc.getElementsByClassName("form-text")(1).Value = "MyFTPUserName"
    doc.getElementsByClassName("form-text")(2).Value = "MyFTPPassWord"
    doc.getElementsByClassName("form-text")(3).Value = "/InitialDirFolder"
    
    Do While IE.Busy
        Application.Wait DateAdd("s", 1, Now)
    Loop
    
    'Click login button
    doc.getElementsByClassName("formbuttonsAlt2")(0).Click
    
    Do While IE.Busy
    Loop
    
    
    doc.getElementsByClassName("smallbutton")(3).Click 'This doesn't work
    
    End Sub
    Last edited by 6StringJazzer; 04-03-2022 at 11:53 AM. Reason: fixed code tags

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Click on button web page using VBA
    By beroghost in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-12-2020, 03:20 PM
  2. Can't Click button [on web page in IE] with only class name
    By drflgd in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-30-2020, 11:16 PM
  3. Get element by value? [click on option button on web page]
    By emjay973 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-10-2017, 05:52 PM
  4. [SOLVED] Use VBA to Automate Actions on Webpage (Open web page, Select Dropdown, click button)
    By ravikiran in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-03-2015, 07:29 AM
  5. Replies: 5
    Last Post: 12-12-2013, 08:51 PM
  6. VB macro to click after logging Page button with attribute Value
    By shreekant in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-17-2013, 07:56 AM
  7. Move the page with button click?
    By horton in forum Excel General
    Replies: 1
    Last Post: 07-05-2008, 01:11 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