How to créate this selection with JS or TinyMCE

I need to create a selection with native JS or TinyMCE methods.

Currently I have this code that does what is shown in the image below:

const table = editor.dom.getParent(editor.selection.getNode(), 'table');
if (table) {
    editor.selection.select(table);
}

I have also tried to do this and it turns out the same as above:

const table = editor.dom.getParent(editor.selection.getNode(), 'table');
if (table) {
    const rng = editor.dom.createRng();
    rng.selectNode(table);
    editor.selection.setRng(rng);
}

Result image I get

I need to make this type of selection with the mouse:

Expected result image