+ Reply to Thread
Results 1 to 4 of 4

Click in Image with iframe

  1. #1
    Registered User
    Join Date
    09-19-2014
    Location
    Sao Paulo
    MS-Off Ver
    2007
    Posts
    4

    Click in Image with iframe

    Dear , good day.

    Need to click a button , but I can not at all.
    Below is what I need button click .

    Botão: window.document.getElementById("btnAtivo").src = "../images/botoes/bt_ativo.gif"

    I tried

    idoc.document.document.getElementById("btnAtivo").click
    idoc.document.document.getElementById("btnAtivo").onclick

    Set ElementCol = Idoc.document.getElementsByTagName("img")

    For Each elea In ElementCol

    If InStr(elea.innerHTML, "../images/botoes/bt_ativo.gif") > 0 Then
    elea.Click

    Exit For

    End If

    Next

    * If you can help me thank you .


    CODE:

    //-->
    </script>
    <script language="VBScript">

    function resultadoVBS()
    Dim cIdPessoa
    Dim cIdCampanha
    Dim cIdPublico
    Dim cIdPesquisa
    Dim cIdPUPE
    Dim cRet

    'Danilo - nao permitir abrir tela de resultado enquanto carrega/limpa pessoa
    Dim cFinalizando

    cFinalizando = parent.parent.item("barrasuperior").hdnFinalizando.value

    'msgbox "Finalizando = " & cFinalizando

    if (cFinalizando = "S") then
    MsgBox "Aguarde o sistema iniciar o novo atendimento."
    exit function
    end if
    '---

    cIdPessoa = parent.parent.item("barrasuperior").item("barraNome").frmBarraSuperior.hdnIdPessoa.value

    window.parent.parent.msgEmail.value = ""

    if (frmComandos.hdnScriptStatus.value = "N") then
    if (MsgBox("O script executado não foi salvo!" & vbCrLf & vbCrLf & "Deseja voltar a Tela de Script para Salva-lo?", 292, "TELE IN-OUT") = 7) then
    MsgBox "As respostas do cliente serão perdidas.", 48, "TELE IN-OUT"
    else
    window.parent.parent.superior.AtivarPasta "SCRIPT", false
    exit function
    end if
    end if

    if trim(cIdPessoa) <> "" and trim(cIdPessoa) <> "NULL" then
    if cLng(cIdPessoa) = 0 then
    msgbox "Não há atendimento a ser salvo.", 48, "TELE IN-OUT"
    exit function
    end if
    else
    msgbox "Não há atendimento a ser salvo.", 48, "TELE IN-OUT"
    exit function
    end if

    cIdCampanha = parent.parent.item("barrasuperior").item("barraCampanha").item("cmbCampanha").document.frmCmbIdCampanha.hdnIdCampanha.value
    cIdPublico = parent.parent.item("barrasuperior").item("barraCampanha").item("cmbCampanha").document.frmCmbIdCampanha.hdnIdPublico.value
    cIdPesquisa = parent.parent.item("barrasuperior").item("barraCampanha").item("cmbCampanha").document.frmCmbIdCampanha.hdnIdPesquisa.value
    cIdPUPE = parent.parent.item("barrasuperior").item("barraCampanha").item("cmbCampanha").document.frmCmbIdCampanha.hdnIdPUPE.value

    if trim(cIdCampanha) = "" then
    if (msgbox("Confirme gravação do atendimento", 292,"Encerramento do Chamado") = 7) then
    exit function
    else
    cIdPublicoIdPUPE = replace(cIdPublicoIdPUPE,"#","~")
    ifrmSalvaAtendimento.location.href = "contResultadoAtendimento.asp?agrupador1=frmChamado&operador=INS&itmIdChamado=&idPublico=" & cIdPublico & "&idCampanha=" & cIdCampanha & "&idPesquisa=" & cIdPesquisa & "&idPUPE=" & cIdPUPE
    bAtendimentoFinalizado = true
    parent.telefonia.finalLigacao(false)
    end if
    else
    cIdPublicoIdPUPE = replace(cIdPublicoIdPUPE,"#","~")
    'window.open "contResultadoAtendimento.asp?agrupador1=frmChamado&operador=INS&itmIdChamado=&idPublico=" & cIdPublico & "&idCampanha=" & cIdCampanha & "&idPesquisa=" & cIdPesquisa & "&idPUPE=" & cIdPUPE, "", "width=800; height=540"
    'Danilo - nao deixar fechar tela de resultado enquanto grava

    Do while (cIdCampanha <> "")

    cRet = showModalDialog ("contResultadoAtendimento.asp?agrupador1=frmChamado&operador=INS&itmIdChamado=&idPublico=" & cIdPublico & "&idCampanha=" & cIdCampanha & "&idPesquisa=" & cIdPesquisa & "&idPUPE=" & cIdPUPE, window ,"help:no;scroll:no;Status:NO;dialogWidth:950px;dialogHeight:600px,dialogTop:0px,dialogLeft:50px")

    'MsgBox (cRet)

    if cRet <> "undefined" and cRet <> "openAgain" then
    bAtendimentoFinalizado = true
    nCarregarPessoa = "-1"
    verificaPausa

    if cRet <> empty then
    if instr(1, cRet, "|") > 0 then
    parent.telefonia.setTelefoniaResultado 0, 1, split(cRet, "|")(0), split(cRet, "|")(1), split(cRet, "|")(2)
    if split(cRet, "|")(3) = "S" then
    parent.telefonia.quantidade = 0
    end if
    end if

    if parent.telefonia.quantidade > 0 then
    parent.telefonia.verificaPessoaPendenteLista
    else
    parent.telefonia.finalLigacao(false)
    end if
    end if

    exit do
    end if

    cIdCampanha = parent.parent.item("barrasuperior").item("barraCampanha").item("cmbCampanha").document.frmCmbIdCampanha.hdnIdCampanha.value
    loop
    end if
    end function
    </script>
    <script type="text/javascript" language="JavaScript" src="../js/funcMess.js"></script>
    <script language="JavaScript" type="text/javascript">
    var strModoAtual;

    function getModoAtual(){
    return frmComandos.hdnModoAtual.value
    }

    function setModoAtual(cModo){
    if (cModo == "") {
    window.document.getElementById("btnAtivo").src = "../images/botoes/bt_ativo.gif"
    window.document.getElementById("btnReceptivo").src = "../images/botoes/bt_receptivo.gif"
    frmComandos.hdnModoAtual.value = ""
    }
    else
    ativaModo(cModo)
    }

    function setModoReceptivo() {
    ifrmBuscaPessoaReceptivo.location.href = "atualizaLOATTMAT.asp?nTipoAtendimento=2"
    window.document.getElementById("btnAtivo").src = "../images/botoes/bt_ativo.gif"
    window.document.getElementById("btnReceptivo").src = "../images/botoes/bt_receptivo03.gif"
    frmComandos.hdnModoAtual.value = "RECEPTIVO"
    strModoAtual = "RECEPTIVO"
    }

    function setModoAtivo() {
    window.document.getElementById("btnAtivo").src = "../images/botoes/bt_ativo.gif"
    window.document.getElementById("btnReceptivo").src = "../images/botoes/bt_receptivo03.gif"
    frmComandos.hdnModoAtual.value = "ATIVO"
    strModoAtual = "ATIVO"
    }

    function ativaModo(strModo){

    *Thanks

    Magushi

  2. #2
    Forum Contributor Jack7774's Avatar
    Join Date
    08-31-2012
    Location
    Georgia, US
    MS-Off Ver
    Excel 2010
    Posts
    576

    Re: Click in Image with iframe

    Put your code in code brackets and your html in html brackets. Its the rule but it makes it easier to read. Have you tried simply navigating to the iframe url instead of trying to operate outside of the iframe?
    Thank those who have helped you by clicking the Star * below their name and please mark your post [SOLVED] if it has been answered satisfactorily.

  3. #3
    Registered User
    Join Date
    09-19-2014
    Location
    Sao Paulo
    MS-Off Ver
    2007
    Posts
    4

    Re: Click in Image with iframe

    jessebranum777, good Morning my friend!

    I tried not to sail out, do not know how to do this .

    but below is my code , in this last part where the For Each , I am trying to click on the image , but without success.

    Is there any way to access without the iframe ?

    Since ja Grateful !

    (Sub xxx()
    Dim HTMLDoc As HTMLDocument
    Dim MyBrowser As InternetExplorer
    Dim MyHTML_Element As IHTMLElement
    Dim MyURL, login, senha As String
    Dim tabPage As Object ' MSHTML.IHTMLElement
    Dim rowTable As Object ' MSHTML.IHTMLElement
    Dim colRow As Object ' MSHTML.IHTMLElement
    Dim ElementTab As Object ' MSHTML.IHTMLElementCollection
    Dim ElementRow As Object ' MSHTML.IHTMLElementCollection
    Dim ElementCol As Object ' MSHTML.IHTMLElementCollection
    Dim ieDoc As Object
    Dim data As String
    Dim SubmitInput As HTMLInputElement

    login = "x"
    senha = "x"

    Set MyBrowser = New InternetExplorer
    MyBrowser.Silent = True
    MyBrowser.navigate MyURL

    Set MyBrowser = New InternetExplorer
    MyBrowser.navigate "xxx"


    Do
    Loop Until MyBrowser.readyState = READYSTATE_COMPLETE

    Set HTMLDoc = MyBrowser.document
    HTMLDoc.all.usuario.Value = login
    HTMLDoc.all.senha.Value = senha

    HTMLDoc.all.Image2.Click
    MyBrowser.navigate "xxxx"
    Application.Wait Now + TimeValue("00:00:05")
    MyBrowser.Visible = True

    SendKeys "{ENTER}", True


    'Set MyBrowser = New InternetExplorer
    MyBrowser.navigate "xxx"
    MyBrowser.Visible = True
    'Application.Wait (Now + TimeValue("0:00:01"))
    ' Set HTMLDoc = MyBrowser.document

    ----------------------------------------------------------------------------------------------
    ' Bellow is error, dont function!

    For Each SubmitInput In MyBrowser.document.frames(3).document.getElementsByTagName("img")
    If InStr(SubmitInput.getAttribute("onclick"), "ATIVO") Then
    SubmitInput.Click
    Exit For
    End If
    Next
    ------------------------------------------------------------------------------------------------
    End Sub )

  4. #4
    Forum Contributor Jack7774's Avatar
    Join Date
    08-31-2012
    Location
    Georgia, US
    MS-Off Ver
    Excel 2010
    Posts
    576

    Re: Click in Image with iframe

    I am not a traditional vba to IE junky as far as the terminology, methods, and or normal way of writing code unfortunately. I can't fix the issue you are having but it looks like you are just trying to login and click the submit button and I correct? Someone once told me set the iframe as an object first then call the element by tag. Maybe that's incorrect advise for this though. What is the website url your attempting to login on? You don't have to give me the login information just the url so I can look at the source code myself.

+ 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. Create a 'click map' on an image
    By Bleekscheetje in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-08-2013, 03:18 PM
  2. Click an image to display a message box
    By newtonlkn in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-24-2012, 03:37 PM
  3. on click of an image excel
    By Ranjani in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-12-2009, 05:44 PM
  4. Counter Macro On Image Click
    By Kolin in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-04-2009, 12:13 PM
  5. Image Invisible. Click
    By shapper in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-20-2008, 04:15 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