access menu with over effect. Selenium VBA

Asked

Viewed 333 times

0

I am having problems accessing an "interactive menu" using the Selenium library in VBA.

follows html code of the page:

    <html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>Planejamento, Orçamento e Gestão</title>
    <link href="/css/barra.css" rel="stylesheet" type="text/css" />
    <link href="/css/styleGOV.css?20012017121545" type="text/css" rel="stylesheet" />

</head>
<body>
        <div id="Header">
            <div class="header">
                <h1 class="top-title-header">Portal de Compras do Governo Federal </h1>             
                <h1 class="title-header">Comprasnet</h1>
                <h1 class="bottom-title-header">MINIST&Eacute;RIO DO PLANEJAMENTO OR&Ccedil;AMENTO E GEST&Atilde;O</h1>
                <div class="info">
                    <span class="orgao">

                          MINIST&Eacute;RIO DO PLANEJAMENTO<br/>Brasília, 20 de Janeiro de 2017 
                    </span>

                        <span class="user">
                        EDUARDO RODRIGUES VIANA
                        </span>

                </div>
            </div>
            <div class="menu-header">
                <div class="content-menu">

                        <span class="ambiente-producao">SIASG - Ambiente Produção</span>

                </div>  
            </div>  
        </div>
    <!-- Inicializacao e construcao do menu -->
    <script type='text/javascript'>function Go() { return }</script>  
    <script type='text/javascript' src='../includes/HorizontalFrames_var.js'></script>
    <script type="text/javascript">

    var NoOffFirstLineMenus=2
    Menu1=new Array("Serviços do Governo", "", "", 5,25, 200, "#01430C", "#01430C", "white", "white", "", "", -1, 0, -1, "center", " ");
Menu1_1=new Array("Troca de Senha","/gerencial/troca_senha.asp","",0,23,220, "", "", "", "", "", "", -1, -1, -1, "left", " ");
Menu1_2=new Array("SIASGWeb","","",4,23,220, "", "", "", "", "", "", -1, -1, -1, "left", " ");
Menu1_2_1=new Array("SIDEC","","",2,23,220, "", "", "", "", "", "", -1, -1, -1, "left", " ");
Menu1_2_1_1=new Array("Aviso","/gerencial/sidecweb/menu.asp?Id=13","",0,23,220, "", "", "", "", "", "", -1, -1, -1, "left", " ");
Menu1_2_1_2=new Array("Imprensa","/gerencial/sidecweb/menu.asp?Id=17","",0,23,220, "", "", "", "", "", "", -1, -1, -1, "left", " ");
Menu1_2_2=new Array("SICON","","",2,23,220, "", "", "", "", "", "", -1, -1, -1, "left", " ");
Menu1_2_2_1=new Array("Cronograma","/gerencial/siconweb/menu.asp?Id=85","",0,23,220, "", "", "", "", "", "", -1, -1, -1, "left", " ");
Menu1_2_2_2=new Array("Cronograma Entidade não SISG","/gerencial/siconweb/menu.asp?Id=264","",0,23,220, "", "", "", "", "", "", -1, -1, -1, "left", " ");
Menu1_2_3=new Array("SISRP","","",1,23,220, "", "", "", "", "", "", -1, -1, -1, "left", " ");
Menu1_2_3_1=new Array("Ata","/gerencial/sisrpweb/menu.asp?Id=210","",0,23,220, "", "", "", "", "", "", -1, -1, -1, "left", " ");
Menu1_2_4=new Array("CLASSIFICADOS","/gerencial/classificados/menu.asp?Id=243","",0,23,220, "", "", "", "", "", "", -1, -1, -1, "left", " ");
Menu1_3=new Array("SIASGNet","","",2,23,220, "", "", "", "", "", "", -1, -1, -1, "left", " ");
Menu1_3_1=new Array("IRP","/gerencial/Gerencial_SIASGNet.asp?ID=10","",0,23,220, "", "", "", "", "", "", -1, -1, -1, "left", " ");
Menu1_3_2=new Array("Divulgação Compras","/gerencial/Gerencial_SIASGNet.asp?ID=30","",0,23,220, "", "", "", "", "", "", -1, -1, -1, "left", " ");
Menu1_4=new Array("Pregão","","",4,23,220, "", "", "", "", "", "", -1, -1, -1, "left", " ");
Menu1_4_1=new Array("Equipe do Pregão","/gerencial/msgBloqueioCertificado.asp","",0,23,220, "", "", "", "", "", "", -1, -1, -1, "left", " ");
Menu1_4_2=new Array("Pregão Eletrônico","/gerencial/msgBloqueioCertificado.asp","",0,23,220, "", "", "", "", "", "", -1, -1, -1, "left", " ");
Menu1_4_3=new Array("Pregão Presencial","/gerencial/msgBloqueioCertificado.asp","",0,23,220, "", "", "", "", "", "", -1, -1, -1, "left", " ");
Menu1_4_4=new Array("Pregão Presencial SRP","/gerencial/msgBloqueioCertificado.asp","",0,23,220, "", "", "", "", "", "", -1, -1, -1, "left", " ");
Menu1_5=new Array("Cotação Eletrônica","","",5,23,220, "", "", "", "", "", "", -1, -1, -1, "left", " ");
Menu1_5_1=new Array("Todas em Andamento","/assinadas/cotacao.asp?filtro=andamento","",0,23,220, "", "", "", "", "", "", -1, -1, -1, "left", " ");
Menu1_5_2=new Array("Adjudicar","/assinadas/cotacao.asp?filtro=adjudicar","",0,23,220, "", "", "", "", "", "", -1, -1, -1, "left", " ");
Menu1_5_3=new Array("Consultar Relatórios","/assinadas/cotacao.asp?filtro=encerradas","",0,23,220, "", "", "", "", "", "", -1, -1, -1, "left", " ");
Menu1_5_4=new Array("Consultar Fornecedores","/assinadas/cotacao.asp?filtro=consForn","",0,23,220, "", "", "", "", "", "", -1, -1, -1, "left", " ");
Menu1_5_5=new Array("Cancelar toda a cotação","/assinadas/cotacao.asp?filtro=cancelartoda","",0,23,220, "", "", "", "", "", "", -1, -1, -1, "left", " ");

    Menu2=new Array("Sair","/logoff.asp","",0,25,70,"#01430C","#01430C","white","white","","",-1,0,-1,"center"," ");

    </script>
    <script type='text/javascript' src='../includes/menu132_com.js'></script>

</body>
</html>

I am trying to "pass" the mouse over the element in the following way:

Set objCollection = driver.findElementByCssSelector("frame[name='main2']")
    driver.SwitchToFrame (objCollection)

    driver.FindElementByXPath("/html/body/div[2]/div[1]").Focus

But I’m not succeeding, any help about thank you already!

  • continue accepting suggestions on how to unlock popups and access the menu via code

  • if you found it useful to vote for the answer

1 answer

0


Guys, I got around the problem by passing the coordinates to the mouse, here goes the code:

'desbloqueia os pop ups
    SetCursorPos 985, 70 'x and y position
    mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
    mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
    SetCursorPos 800, 143 'x and y position
    mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
    mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
    SetCursorPos 860, 210 'x and y position
    mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
    mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0

'faz a interação com o menu
    SetCursorPos 150, 250 'x and y position
    newHour = Hour(Now())
    newMinute = Minute(Now())
    newSecond = Second(Now()) + 3
    waitTime = TimeSerial(newHour, newMinute, newSecond)
    Application.Wait waitTime
    SetCursorPos 150, 325 'x and y position
    newHour = Hour(Now())
    newMinute = Minute(Now())
    newSecond = Second(Now()) + 3
    waitTime = TimeSerial(newHour, newMinute, newSecond)
    Application.Wait waitTime
    SetCursorPos 400, 325 'x and y position
    newHour = Hour(Now())
    newMinute = Minute(Now())
    newSecond = Second(Now()) + 3
    waitTime = TimeSerial(newHour, newMinute, newSecond)
    Application.Wait waitTime
    mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
    mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0

however I am not sure if this application is safe. I continue accepting suggestions on how to unlock popups and access the menu via code

Browser other questions tagged

You are not signed in. Login or sign up in order to post.