addToolbarMenu change option select by code

Hello,

How to change addToolbarMenu option selection in background mode?

Thanks

var toolbar = document.getElementById('toolbar');
  
  // When a new <option> is selected
  toolbar.addEventListener('change', function() {
    var index = toolbar.selectedIndex;
    console.log('selectedIndex: ' + index);
  });

Always undefined...