Notifications
Clear all

[Resolvido] [VBA - Selenium] Como referenciar o seguinte elemento HTML

3 Posts
1 Usuários
0 Reactions
864 Visualizações
(@anonimo20)
Posts: 0
New Member
Topic starter
 

Boa tarde pessoal,

Estou c/ dificuldades p/ referenciar o seguinte elemento p/ utiliza-lo c/ o Selenium VBA:

<button class="appBarTab-header allowFlyoutClickPropagation" type="button" data-dyn-bind="
        id: $data.Id + '_button',
        keyDown: $data.keyDown,
        enabled: $data.Enabled,
        focusIn: $data.focusIn,
        click: $data._headerClicked,
        superTooltip: $dyn.ui.superTooltip($data),
        flyout: {
            flyout: $('.appBar-flyout', $element.parentElement),
            show: $data.FlyoutExpanded,
            at: 'manual',
            openOnClick: false,
            clickSubscriber: $data.flyoutClickSubscriber,
            entranceAnimation: 'appBar-growHeight',
            exitAnimation: $data.flyoutExitAnimation,
            }" id="EcoResProductDetailsExtended_5_ActionPaneTabDefine_button" dyn-data-supertooltip="true" aria-expanded="false">
        <span class="appBarTab-headerLabel allowFlyoutClickPropagation" data-dyn-bind="
              text: $data.Label">Produto</span>
</button>

 

já tentei pelo Xpath, porém o id do elemento sempre muda:

Exemplo
primeiro estava assim:
//*[@id="EcoResProductDetailsExtended_5_ActionPaneTabDefine_button"]

mas depois vi que o valor sempre alterava:
//*[@id="EcoResProductDetailsExtended_6_ActionPaneTabDefine_button"]

Poderiam me ajudar?

 

 
Postado : 09/10/2023 1:40 pm
(@anonimo20)
Posts: 0
New Member
Topic starter
 

Pessoal, no final do código html que postei está escrito "Produto", que é o nome do botão da página que preciso acessar é possível referenciar através disso?

<span class="appBarTab-headerLabel allowFlyoutClickPropagation" data-dyn-bind="
              text: $data.Label">Produto</span>
 
Postado : 09/10/2023 1:56 pm
(@anonimo20)
Posts: 0
New Member
Topic starter
 

Consegui pessoal, o ChatGPT me ajudou, fui testar e ele já escreve em VBA também, consegui referenciar com o Xpath da seguinte forma:

driver.FindElementByXPath("//button[contains(., ""Produto"")]")
 
Postado : 09/10/2023 2:48 pm