【发布时间】:2021-07-08 15:30:15
【问题描述】:
HTML
<div id="model" class="mobile handsontable htRowHeaders htColumnHeaders" style="height: 100%; overflow: hidden;" data-originalstyle="height: 100%; overflow: hidden;">
<div class="ht_master handsontable"><div class="wtHolder" style="position: relative; height: 380px; width: 1468px;">
<div class="wtHider" style="width: 2550px; height: 2109px;">
<div class="wtSpreader" style="position: relative; top: 0px; left: 0px;">
<table class="htCore">
<colgroup>
<col class="rowHeader" style="width: 50px;">
<col style="width: 400px;">
<col style="width: 70px;">
<col style="width: 70px;">
<col style="width: 70px;">
<col style="width: 70px;">
<col style="width: 70px;">
<col style="width: 70px;">
<col style="width: 70px;">
<col style="width: 70px;">
<col style="width: 70px;">
<col style="width: 70px;">
<col style="width: 70px;">
<col style="width: 70px;">
<col style="width: 70px;">
<col style="width: 70px;">
<col style="width: 70px;">
<col style="width: 70px;">
<col style="width: 70px;">
<col style="width: 70px;">
<col style="width: 70px;">
<col style="width: 70px;">
<col style="width: 70px;">
<col style="width: 70px;">
<col style="width: 70px;">
<col style="width: 70px;">
<col style="width: 70px;">
</colgroup>
<thead>
<tr>
<th class="">
<div class="relative">
<span class="colHeader cornerHeader"> </span>
</div>
</th>
<th class="">
<div class="relative">
<span class="colHeader">Division, Base Alternative</span>
</div>
</th>
<th class="">
<div class="relative">
<span class="colHeader">2015 (M)</span>
</div>
</th>
<th class="">
<div class="relative">
<span class="colHeader">2016 (N)</span>
</div>
</th>
<th class="">
<div class="relative">
<span class="colHeader">2017 (O)</span>
</div>
</th>
<th class="">
<div class="relative">
<span class="colHeader">2018 (P)</span>
</div>
</th>
<th class="">
<div class="relative">
<span class="colHeader">2019 (Q)</span>
</div>
</th>
</tr>
<thead>
<tr> <th class="" style="height: 17px;">
<div class="relative">
<span class="rowHeader">1</span>
</div>
</th>
<td class="htDimmed htNoWrap"></td>
<td class="afterHiddenColumn htDimmed htNoWrap"></td>
<td class="htDimmed htNoWrap"></td>
<td class="htDimmed htNoWrap"></td>
<td class="htDimmed htNoWrap"></td>
<td class="htDimmed htNoWrap"></td>
<td class="htDimmed htNoWrap"></td>
<td class="htDimmed htNoWrap"></td>
<td class="htDimmed htNoWrap"></td>
<td class="htDimmed htNoWrap"></td>
<td class="htDimmed htNoWrap"></td>
<td class="htDimmed htNoWrap"></td>
<td class="htDimmed htNoWrap"></td>
<td class="htDimmed htNoWrap"></td>
<td class="htDimmed htNoWrap"></td>
<td class="htDimmed htNoWrap"></td>
<tr>
<th class="" style="height: 17px;">
<div class="relative">
<span class="rowHeader">2</span>
</div>
</th>
<td class="htDimmed htNoWrap" title="" style="background-color: rgb(194, 218, 254); font-size: 10pt; color: rgb(0, 0, 0); text-align: left;"></td>
<td class="afterHiddenColumn htDimmed htNoWrap" title="" style="background-color: rgb(255, 255, 255); font-size: 10pt; color: rgb(0, 0, 0); text-align: center;"></td>
<td class="htDimmed htNoWrap" title="" style="background-color: rgb(255, 255, 255); font-size: 10pt; color: rgb(0, 0, 0); text-align: center;"></td>
<td class="htDimmed htNoWrap" title="" style="background-color: rgb(255, 255, 255); font-size: 10pt; color: rgb(0, 0, 0); text-align: center;"></td>
<td class="htDimmed htNoWrap" title="" style="background-color: rgb(255, 255, 255); font-size: 10pt; color: rgb(0, 0, 0); text-align: center;"></td>
<td class="htDimmed htNoWrap" title="" style="background-color: rgb(255, 255, 255); font-size: 10pt; color: rgb(0, 0, 0); text-align: center;"></td>
</tr>
<tr>
<th class="" style="height: 17px;">
<div class="relative">
<span class="rowHeader">3</span>
</div>
</th>
<td class="htNoWrap" title="" style="background-color: rgb(194, 218, 254); font-size: 10pt; color: rgb(0, 0, 0); text-align: left;">Model period</td>
<td class="afterHiddenColumn htRight htNumeric htNoWrap" title="" style="background-color: rgb(255, 255, 128); font-size: 10pt; color: rgb(0, 0, 0); text-align: center;">0</td>
<td class="htRight htNumeric htNoWrap" title="" style="background-color: rgb(255, 255, 128); font-size: 10pt; color: rgb(0, 0, 0); text-align: center;">0</td>
<td class="htRight htNumeric htNoWrap" title="" style="background-color: rgb(255, 255, 128); font-size: 10pt; color: rgb(0, 0, 0); text-align: center;">0</td>
<td class="htRight htNumeric htNoWrap" title="" style="background-color: rgb(255, 255, 128); font-size: 10pt; color: rgb(0, 0, 0); text-align: center;">0</td>
<td class="htRight htNumeric htNoWrap" title="" style="background-color: rgb(255, 255, 128); font-size: 10pt; color: rgb(0, 0, 0); text-align: center;">0</td>
<td class="htRight htNumeric htNoWrap" title="" style="background-color: rgb(255, 255, 128); font-size: 10pt; color: rgb(0, 0, 0); text-align: center;">0</td>
<td class="htRight htNumeric htNoWrap" title="" style="background-color: rgb(255, 255, 128); font-size: 10pt; color: rgb(0, 0, 0); text-align: center;">0</td>
<td class="htRight htNumeric htNoWrap" title="" style="background-color: rgb(255, 255, 128); font-size: 10pt; color: rgb(0, 0, 0); text-align: center;">0</td>
</tr>
<tr>
<th class="" style="height: 17px;">
<div class="relative">
<span class="rowHeader">7</span>
</div>
</th>
<td class="htNoWrap" title="" style="background-color: rgb(194, 218, 254); font-size: 10pt; color: rgb(0, 0, 0); text-align: left;">Pulp sales, pulp mill, MUSD</td>
<td class="afterHiddenColumn htNoWrap" title="" style="background-color: rgb(255, 255, 255); font-size: 10pt; color: rgb(0, 0, 0); text-align: center;">0</td>
<td class="htNoWrap" title="" style="background-color: rgb(255, 255, 255); font-size: 10pt; color: rgb(0, 0, 0); text-align: center;">0</td>
<td class="htNoWrap" title="" style="background-color: rgb(255, 255, 255); font-size: 10pt; color: rgb(0, 0, 0); text-align: center;">597</td>
<td class="htNoWrap" title="" style="background-color: rgb(255, 255, 255); font-size: 10pt; color: rgb(0, 0, 0); text-align: center;">572</td>
<td class="htNoWrap" title="" style="background-color: rgb(255, 255, 255); font-size: 10pt; color: rgb(0, 0, 0); text-align: center;">648</td>
<td class="htNoWrap" title="" style="background-color: rgb(255, 255, 255); font-size: 10pt; color: rgb(0, 0, 0); text-align: center;">35</td>
<td class="htNoWrap" title="" style="background-color: rgb(255, 255, 255); font-size: 10pt; color: rgb(0, 0, 0); text-align: center;">326</td>
<td class="htNoWrap" title="" style="background-color: rgb(255, 255, 255); font-size: 10pt; color: rgb(0, 0, 0); text-align: center;">326</td>
</tr>
<tr>
<th class="" style="height: 17px;">
<div class="relative">
<span class="rowHeader">8</span>
</div>
</th>
<td class="htNoWrap" title="" style="background-color: rgb(194, 218, 254); font-size: 10pt; color: rgb(0, 0, 0); text-align: left;">Pulp sales, paper mill, MUSD</td>
<td class="afterHiddenColumn htNoWrap" title="" style="background-color: rgb(255, 255, 255); font-size: 10pt; color: rgb(0, 0, 0); text-align: center;">0</td>
<td class="htNoWrap" title="" style="background-color: rgb(255, 255, 255); font-size: 10pt; color: rgb(0, 0, 0); text-align: center;">0</td>
<td class="htNoWrap" title="" style="background-color: rgb(255, 255, 255); font-size: 10pt; color: rgb(0, 0, 0); text-align: center;">0</td>
<td class="htNoWrap" title="" style="background-color: rgb(255, 255, 255); font-size: 10pt; color: rgb(0, 0, 0); text-align: center;">0</td>
<td class="htNoWrap" title="" style="background-color: rgb(255, 255, 255); font-size: 10pt; color: rgb(0, 0, 0); text-align: center;">0</td>
<td class="htNoWrap" title="" style="background-color: rgb(255, 255, 255); font-size: 10pt; color: rgb(0, 0, 0); text-align: center;">0</td>
<td class="htNoWrap" title="" style="background-color: rgb(255, 255, 255); font-size: 10pt; color: rgb(0, 0, 0); text-align: center;">0</td>
<td class="htNoWrap" title="" style="background-color: rgb(255, 255, 255); font-size: 10pt; color: rgb(0, 0, 0); text-align: center;">0</td>
<td class="htNoWrap" title="" style="background-color: rgb(255, 255, 255); font-size: 10pt; color: rgb(0, 0, 0); text-align: center;">0</td>
</tr>
</thead>
我想在如下所示的网格中获取特定单元格
基于左侧的行号和顶部的列名。
假设我想获取值为
597的单元格
而不是使用值/文本或索引来查找它,
我想根据row number&column name获取单元格
类似的东西
找到行号为 7 列名为 2017 (O) 的单元格
预期输出
597
如果选择了行或列
的类
他们得到一个名为ht__highlight
如果单元格被选中
的类
它有一个名为htNoWrap current highlight
我已经搜索了 2 天,
我找不到任何答案或
这种情况的例子
这很难解释,所以我为混乱的解释道歉
提前致谢!!!!
【问题讨论】:
-
你把一切都复杂化了。只需为页面添加 html 代码。
-
我将添加定位器的外观,但如果没有完整的 HTML,很难确定
标签: python selenium selenium-webdriver html-table