Results 1 to 9 of 9
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    intercept click on web page (2000 sr 1)

    ... i cannot intercept the command to click on "CONNETTI"...

    have error "91" in: ipf.Click

    attach file of web page and image...
    code:

    Sub PROVA()

    ' Prepare to open the web page
    Set ie = CreateObject("InternetExplorer.Application")

    With ie
    .Visible = True
    .Navigate "http://crediti/cr/html/logon/logonAutenticazione.html"

    ' Loop until the page is fully loaded
    Do Until Not .Busy
    DoEvents
    Loop

    ' Make the desired selections on the web page and click the submit Button
    ' IE ie.document.all.Item LEGGE NELLA PAGINA html il tag di riferimento
    Set ipf = ie.document.all.Item("USER-ID_0")
    ipf.Value = Range("a1") '.Value
    Set ipf = ie.document.all.Item("PASSWORD_0")
    ipf.Value = Range("b1") '.Value
    'Set ipf = ie.document.all.Item("CHOICE")
    'ipf.Value = Range("c1") '.Value
    Set ipf = ie.document.all.Item("CONNETTI")
    ipf.Click

    ' Loop until the page is fully loaded
    Do Until Not .Busy
    DoEvents
    Loop

    End With

    ' Close the internet explorer application
    ie.Quit

    End Sub

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: intercept click on web page (2000 sr 1)

    I cannot open the web page you refer to.

  3. #3
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: intercept click on web page (2000 sr 1)

    Is a page on a farm web server...not public
    Have attached the html in logon.txt
    the macro put the value in USER-ID_0 and put value PASSWORD_0 but not intercept the click on CONNETTI

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: intercept click on web page (2000 sr 1)

    This is not an Excel problem, I cannot help with it.

  5. #5
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: intercept click on web page (2000 sr 1)

    OK I had to go to babel fish to translate the error message. It is stating that a variable has not been set and i can see that this is CONNETTI.

    The variables are being sent via the javascript this message is a cross between Excel and Javascript
    Jerry

  6. #6
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Click web page link that has no name or id

    <P ID="edit" class=small>(Edited by jscher2000 on 18-May-06 14:11. Added references to MSDN and about cross-browser (standards-compliant) alternative.)</P>If you look carefully, you will see a major difference between the three different objects: you are referring to the first two by their name= attribute. But the third object, the link, does not have a name= attribute. You cannot use the display text of a link as a key in the document.all collection.

    You could try this instead:

    Set ipf = ie.document.all.tags("A")[0]
    ipf.Click

    That uses the tags method of the all collection to get an object reference to the first (number 0) hyperlink in the document.
    (See: tags Method on MSDN)

    I did not test that code, but please try it and see whether it helps. (Sometimes Microsoft script interpreters prefers that the collection index be written as (0) rather than [0], so you could try that, too.)

    Added: If you were using this in a cross-browser environment, the code would be:

    Set ipf = ie.document.getElementsByTagName("A")[0]
    ipf.Click

    (See: getElementsByTagName Method on MSDN)

  7. #7
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Click web page link that has no name or id

    Hi jscher2000 tks for suggestion but now have a prob to click on button "AVANTI" and click it...
    Tks in advance

    <td class="INFO" align="center" colspan="11">

    <table border="0" CELLPADDING="0" CELLSPACING="0" width="75" height="25">
    <tr>
    <td WIDTH="25%" ALIGN="left" class="DETTAGLIO"><input TYPE="button" NAME="PAGINA_INDIETRO" ID="PAGINA_INDIETRO" VALUE="Indietro" DISABLED STYLE="width: 60px; height: 20px; cursor: hand; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; font-weight: bold"></td>
    <td WIDTH="25%" ALIGN="center"><font style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; font-weight: bold">Pagine1di4</font></td>
    <td WIDTH="25%" ALIGN="right" class="DETTAGLIO"><input TYPE="button" onClick="java script: cambiaPagina( '2' );" NAME="PAGINA_AVANTI" ID="PAGINA_AVANTI" VALUE="Avanti" STYLE="width: 60px; height: 20px; cursor: hand; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; font-weight: bold"></td>
    </tr>
    </table>
    <input TYPE="hidden" NAME="NUMERO_PAGINE" ID="NUMERO_PAGINE" VALUE="4"></td>

  8. #8
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Click web page link that has no name or id

    Hi Sal

    [polite smiley]

    You are venturing into a very complex piece of work now where you are working across two applications Excel and HTML/Javascript. This type of work is very specialist and I believe you should go towards a specialist web forum...I suggest that as you are a member of quite a few technical forums you go to a specific Javascript flavoured one...possibly http://www.tek-tips.com where you are a member, who have very strong skill sets in that area and if you are lucky they may even write the code you want...but I am afraid you are not going to get the code written here.......sorry

    [/polite smiley]
    Jerry

  9. #9
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Click web page link that has no name or id

    > now have a prob to click on button "AVANTI" and click it...

    I think you are looking at the button's displayed text. You need to look at its name= attribute in order to find it in the document.all collection:

    <input TYPE="button" onClick="java script: cambiaPagina( '2' );" NAME="PAGINA_AVANTI" ID="PAGINA_AVANTI" VALUE="Avanti" STYLE="width: 60px; height: 20px; cursor: hand; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; font-weight: bold">

    As noted above, it is difficult to mix and match sample code between VBA applications and HTML/JavaScript applications. Hopefully you can find some good resources.

Posting Permissions

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