-
<button id="__xmlview0--objectPage-anchBar-__section1-__xmlview0--objectPage-2-anchor-internalSplitBtn-arrowButton"
data-sap-ui="__xmlview0--objectPage-anchBar-__section1-__xmlview0--objectPage-2-anchor-internalSplitBtn-arrowButton"
data-sap-ui-render=""
data-ui5-accesskey=""
aria-label="פתח תפריט"
class="sapMBtnBase sapMBtn sapMSBArrow"
tabindex="-1"
aria-expanded="true"
role="none"
aria-controls="__menu12">
</button> I have a button element that opens a menu, the only connection between them in the HTML is an attribute called aria-controls that holds the ID of the menu(I cannot know the ID in advance as it is dependent on the number of menus in the screen) but that attribute only appears when the menu is already expanded. self.click('//div[@aria-posinset="2"]//div[@class="sapMSBInner"]//button[@aria-label="פתח תפריט"]')
menu_id = self.get_attribute(
'//div[@aria-posinset="2"]//div[@class="sapMSBInner"]//button[@aria-label="פתח תפריט"]', 'aria-controls') I tried the code above to get the value from "aria-controls" but got an error that the attribute does not exist this is the menu element for reference <div id="__menu12"
data-sap-ui="__menu12"
data-sap-ui-render=""
tabindex="-1"
hidefocus="true"
class="sapUiMnu sapUiMnuCozySupport sapMMenu sapUiShd"
data-sap-ui-popup="id-1700648347842-65" >
<ul role="menu" class="sapUiMnuLst sapUiMnuNoIco sapUiMnuNoSbMnu"></ul>
</div>
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Have you tried simplifying the selector to attribute = self.get_attribute('button[aria-label="פתח תפריט"]', 'aria-controls') Or if it's already visible, you can use this to click it: self.click('button[aria-label="פתח תפריט"]') If it's hidden, you can use self.js_click('button[aria-label="פתח תפריט"]') Whenever there's a hidden menu item under a dropdown menu, use |
Beta Was this translation helpful? Give feedback.
Have you tried simplifying the selector to
'button[aria-label="פתח תפריט"]'
? (That should work as a CSS Selector)Or if it's already visible, you can use this to click it:
If it's hidden, you can use
js_click()
to click it:Whenever there's a hidden menu item under a dropdown menu, use
self.js_click(selector)
to click it directly.