I have a menu item that looks like a checkbox:
I would like to click/not-click on it depending on the current value. How do I get the current value?
My code for accessing and clicking it looks like this:
let menuBars = application.menuBars
let outlineModeMenuItem = menuBars.menuItems["outline_mode"]
outlineModeMenuItem.click()
The element structure looks like this:
Attributes: MenuItem, {{0.0, 401.0}, {220.0, 22.0}}, identifier: 'outline_mode', title: 'Outline Mode', Disabled
Element subtree:
→MenuItem, 0x11e14e410, {{0.0, 401.0}, {220.0, 22.0}}, identifier: 'outline_mode', title: 'Outline Mode', Disabled
Path to element:
→Application, 0x10f10cf00, pid: 90531, title: 'Vectornator', Disabled
↳MenuBar, 0x11e1178a0, {{0.0, 0.0}, {1440.0, 24.0}}
↳MenuBarItem, 0x11ce5bad0, {{401.0, 0.0}, {50.0, 24.0}}, title: 'View'
↳Menu, 0x11ce5bbe0, {{401.0, 24.0}, {220.0, 682.0}}
↳MenuItem, 0x11e14e410, {{0.0, 401.0}, {220.0, 22.0}}, identifier: 'outline_mode', title: 'Outline Mode', Disabled
So it doesn't have any "checkbox" item above or below it. value
for it is empty :/ UI reads checkbox value from UICommand.state
, but that doesn't seem to be exposed on XCUIElement
.