Check if button exists?

can someone point me in the right direction to do this? I’ve tried get-udelement -id mybutton but its not working tried to get the text value and that didn’t work either, i’m missing something simple.

trying to test when to sync a table after the button appears but can’t find a way to test when the button loads into the dashboard.

Really difficult to help without seeing the code. Please post the snippet showing the button, as well as your call to Get-UDElement, so we can see what you see.

i can’t copy out code off my work machine :(, but its simple to test just add a button I would think that if the button exists getting the element should return true or false. or if I can get the text value of the button so I can test if the button exists on the page. but not matter what I do getting the element returns null .

new-udbutton -id 'test' -title 'test' -onclick{}
$mybutton = get-udelement -id 'test'

show-udtoast -message "$mybutton"

You need to have some sort of trigger for the Get-UDElement, such as putting it inside the -OnClick block. This works just fine for me:

New-UDDashboard -Title 'Home' -Content {
    New-UDButton -Id "MyButton" -Text "Click Me!" -OnClick {
        $myButton = (Get-UDElement -Id "MyButton")
        Show-UDToast -Message $myButton -Duration 2000