+ Reply to Thread
Results 1 to 6 of 6

Unable to get the getElementById from a webpage

  1. #1
    Registered User
    Join Date
    10-28-2013
    Location
    bangalore
    MS-Off Ver
    Excel 2013
    Posts
    37

    Unable to get the getElementById from a webpage

    Hello All,

    I am trying to access a webpage and update the user name and password, but unable to get the getElementById

    I tried the similar code with google and yahoo, they work perfectly. Below is the code I'm using

    Sub Openurl()

    Dim IE As Object
    Dim IEPage As Object
    Dim IEPageElement As Object

    Set IE = CreateObject("InternetExplorer.Application")

    IE.Visible = True

    IE.navigate URL

    ' The below piece of code also does not work

    Do Until IE.readyState = 4 'READYSTATE_COMPLETE in early binding
    DoEvents
    Loop


    Set IEPage = IE.Document

    Set IEPageElement = IEPage.getElementById(cwsUID)
    If Not IEPageElement Is Nothing Then


    IEPageElement.Value = UserName

    Set IEPageElement = Nothing

    Else

    MsgBox "Coould not find the '" & UNElementID & "' element ID on the page!", vbCritical, "Element ID Error"

    Exit Sub

    End If


    End Sub

    --------------------------------------------------



    Kindly let me know if there is something wrong with this code.

  2. #2
    Registered User
    Join Date
    10-28-2013
    Location
    bangalore
    MS-Off Ver
    Excel 2013
    Posts
    37

    Re: Unable to get the getElementById from a webpage

    Below is the source code



    input type="text" name="cwsUID" id="cwsUID" value="" placeholder="CWS ID" autocomplete="off" autofocus=autofocus

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: Unable to get the getElementById from a webpage

    Post the URL.

    PS Can you add code tags when posting code?
    If posting code please use code tags, see here.

  4. #4
    Registered User
    Join Date
    10-28-2013
    Location
    bangalore
    MS-Off Ver
    Excel 2013
    Posts
    37

    Re: Unable to get the getElementById from a webpage

    Hello Norie,

    I was able to get the GetElementID by using

    Set IE = New InternetExplorerMedium

    But now I'm unable to click on the <A> tag link from the webpage, below is the source code of the link

  5. #5
    Registered User
    Join Date
    10-28-2013
    Location
    bangalore
    MS-Off Ver
    Excel 2013
    Posts
    37

    Re: Unable to get the getElementById from a webpage

    I am unable to post the codes here

  6. #6
    Registered User
    Join Date
    10-28-2013
    Location
    bangalore
    MS-Off Ver
    Excel 2013
    Posts
    37

    Re: Unable to get the getElementById from a webpage

    Hello Norie,

    I have seen your multiple threads related to IE issues and I know you wud be the right person for me to help.
    I cannot paste the URL here as it is a company's intranet and one needs to have access. But I'm posting the entire source code which has the href which

+ 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. getElementByID with duplicate IDs in the webpage
    By vincenzo345 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-07-2015, 11:32 PM
  2. getelementbyid with duplicate ID's on Page
    By manofcheese in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 08-31-2015, 09:16 PM
  3. getElementById run-time 13 type mismatch error
    By killerkoz17 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-31-2014, 10:41 PM
  4. [SOLVED] Load webpage on TOPMAN website, extract prices from webpage into Spreadsheet
    By AKK9 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-04-2013, 11:49 AM
  5. IE.document.getElementByID returns run-time error '91'
    By matt100 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-25-2013, 09:32 PM
  6. problem extracting data from webpage using getelementbyid
    By mwalshe99 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-11-2012, 08:57 AM
  7. Replies: 0
    Last Post: 02-01-2006, 07:20 AM

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