I need to get the ID of one of the elements inside a combobox

0

I have the following X path: //*[@id="selectDashboard"] inside that there are some ID's that would be of certain Dashboard's, how do I get these guys inside the Xpath? HTML code of the dashboard with an ID inside it: and also consider that this is a combobox

<option value="8" title="Overview of application activity on your network" lastviewed="1510593168860" dashboarddesc="Overview of application activity on your network" isshared="false" selected="">Application Overview</option>
    
asked by anonymous 13.11.2017 / 20:19

2 answers

0

To get an element through the xpath using the id just make the second form

//option[@id="iddesejado"]

If you still want to filter more you can use

//option[@id="iddesejado"][@value="checked"]

You can add as many parameters as you like.

    
13.11.2017 / 21:21
0

In the example below, you manipulate the ID attribute of the selected option.

$('#exemplo').change(function() {
    var valor = this.value;
    var id= $(this).find(':selected').attr('id');
    console.log(valor, id);
});
    
13.11.2017 / 22:22