Is it possible to select from dropdown in YADA?

I am playing with dash-yada. When I look through the code I see the possible actions are click, dblclick, sendKeys, type. I am trying to find a way to make yada select from a dropdown. I know the particular value will always be there. I know the value will always be the last one in the options. I thought maybe I could do a ‘type’ action with the value I want as the ‘action_args’ but I could not get that to work. Is it possible to have yada select a value from a dropdown? If so, how?

Hello @Brent,

Yes, it is possible.

You’ll need to chain together a few actions:

1 - activate the dropdown, this can be a click.

2 - then select from the dropdown, this will also be a click.

I tried this among other things but it does not do anything.

{‘target’: f"#{CLUSTER_PREFIX}new-region-dd",
‘convo’: “”“I will activate the dropdown by clicking on it.”“”,
‘action’: ‘click’},
{‘target’: f"#{CLUSTER_PREFIX}new-region-dd .value",
‘convo’: “”“I will select new”“”,
‘action’: ‘click’,
‘action_args’: ‘new’},

If you can give an example app, that would be helpful. :slight_smile:

#!/usr/bin/env python3
"""Minimal dash program."""

from dash import Dash, dcc
import dash_bootstrap_components as dbc
from dash_yada import YadaAIO

app = Dash(__name__, external_stylesheets=[dbc.themes.BOOTSTRAP])

scripts = {'my_script': [{'target': '#dropdown',
                          'convo': """
                          This is a dropdown.
                          """},
                         {'target': '#dropdown',
                          'convo': """
                          activate dropdown
                          """,
                          'action': 'click'},
                         {'target': '#dropdown',
                          'convo': """
                          select from dropdown
                          """,
                          'action': 'click'}
                         ]}
yada = YadaAIO(yada_id="my_yada", scripts=scripts)

app.layout = dbc.Container([yada,
                            dcc.Dropdown(id='dropdown',
                                         options=['first',
                                                  'second',
                                                  'new'],
                                         value='first')],
                           fluid=True)

if __name__ == '__main__':
    app.run_server(debug=True)

Does anyone have any ideas on how to make the clicks work?

@jinnyzor I am looking at this again and trying to get it to work. Given my example, how would I make yada select ‘new’ from the dropdown?

You’ll have to look at the process to step through the selector in order to get the proper one setup.

#dropdown click
#dropdown .option click

At least for the time-being, I am almost to a point in work where I can take a look at controlling the application with set_props giving a much more flexible approach to the scripts.

If you want, you can contribute the repo as well. :smiley:

What is the zIndex of yada? I do not want him over the top of my error message toasts.

You can view and make styling adjustments by inspecting the YADA when in sleep and in active mode. All styling comes from a styling sheet for it.

Thanks, yada is zIndex 9999. I now have my error message toasts on top.