var gorod = 'Уфа'
for (var i = 0; 15; i++) {
var listTable = window.document.querySelectorAll('#stat_data > div.tournament-tabs.rnpqq.js-tournament-tabs > div._light.mghhp.js-tournament-tab-content.tournament-tabs__content._active.tabs-content > div > table > tbody > tr')
var komanda = listTable[i].querySelector('table-item__name')
if komanda == gorod {
var win = //выиграно матчей
}
}
function getWinCount(team) {
const el = Array
.from(document.querySelectorAll('.table-item__name'))
.find(n => n.textContent === team);
return el ? +el.closest('tr').children[3].textContent : null;
}
const wins = getWinCount('Уфа');
Мой браузер не поддерживает ES-2015
function getWinCount(team) {
var el = null;
[].concat.apply([], document.querySelectorAll('.table-item__name')).forEach(function(n) {
if (!el && n.textContent === team) {
el = n;
}
});
if (!el) {
return null;
}
do {
el = el.parentNode;
} while (el.tagName !== 'TR');
return +el.children[3].textContent;
}
let search = 'Уфа',
commands = document.querySelectorAll('.table-item__name'),
command = [...commands].find(x => x.textContent === search),
row = command.closest('tr'),
cells = row.querySelectorAll('td'),
result = cells[3].textContent
var search = 'Уфа',
result = Array.from(document.querySelectorAll('.table-item__name'))
.find(x => x.textContent === search)
.closest('tr')
.querySelectorAll('td')[3].textContent