【发布时间】:2020-02-29 21:05:36
【问题描述】:
我有这个 HTML 元素代码,我目前正在努力想用它来单击显示问题的选项卡。由于“问题”没有唯一的类名或元素 ID,我无法弄清楚如何发送 Click()。
我尝试检查 z-index 是否可以用作索引(假设)并在代码行下方使用
browser.switch_to_frame(a[3])
但看来我错了。
HTML代码如下
<div class="TabsViewPort" style="position: relative; overflow: hidden; width: 896px; height: 22px; float: left;">
<div style="overflow: visible; float: left; width: 897px; top: 0px; left: 0px;">
<dl class="OuterOuterTab">
<dd class="OuterTab" artabid="955000038" arwindowid="0" style="top: 1px; z-index: 1; left: 0px; visibility: inherit; display: block;"><span class="TabLeftRounded"> </span>
<span class="Tab"><a href="javascript:" class="btn f1" style="color:#000000;">My Profile</a>
</span>
<span class="TabRight"> </span>
</dd>
<dd class="OuterTabSelected" artabid="600000203" arwindowid="0" style="top: 1px; z-index: 3; left: 63px; visibility: inherit; display: block;"><span class="TabLeft"> </span>
<span class="Tab"><a href="javascript:" class="btn f1">Approval</a>
</span>
<span class="TabRight"> </span>
</dd>
<dd class="OuterTab" artabid="536870915" arwindowid="0" style="top: 1px; z-index: 1; left: 409px; visibility: inherit; display: block;"><span class="TabLeft"> </span>
<span class="Tab"><a href="javascript:" class="btn f1">Problem</a>
</span>
<span class="TabRight"> </span>
</dd>
</dl>
</div>
</div>
【问题讨论】:
标签: python selenium xpath webdriverwait xpath-1.0