I'm trying to convert this css_selector to an xpath that gets team names on this site
So: match-pop-market > #options_table > tbody > tr#mta_row > td:nth-child(1) works.
So converting it with same logic, it should look like:
//sport-match-grp[not(contains(@style, "display: none;"))]//*[contains(@class, 'match-pop-market')]//table[contains(@id, 'options_table')]//tbody//tr[contains(@id, 'mta_row')]//td[1]
This does not work. I'm having trouble with: //*[contains(@class, 'match-pop-market')]. Removing this helps, but why does this work as a css but not as an xpath?
<sport-match-grp style="display: inline;">
<table id="options_table" class="mpm_teams style-scope match-pop-market">
<tr id="mta_row" class="style-scope match-pop-market"><td class="match-pop-market" style="width: 60%;">Panama</td><td class="match-pop-market mpm_teams_cell mpm_teams_cell_click" data-product="AWin" data-div="3.2" data-eventid="6238456"><span class="match-pop-market mpm_teams_bet_val">3.20</span></td><td class="match-pop-market mpm_teams_cell mpm_teams_cell_click" data-product="Draw" data-div="3" data-eventid="6238456" rowspan="2"><span class="match-pop-market mpm_teams_bet_val">3.00</span></td></tr>
I believe the answer should be as simple as that that selector is not above it so of course it should not work.
So this works:
//sport-match-grp[not(contains(@style, "display: none;"))]//*[contains(@class, 'match-pop-market')][contains(@id, 'options_table')]//tr[contains(@id, 'mta_row')]//td[1]
Note:
//*[contains(@class, 'match-pop-market')][contains(@id, 'options_table')]
Uh right... so match-pop-market > #options_table
behaves near identically to the above where it gets elements that exists in match-pop-market. Options_tables also exists so it works. This clears things up for me