<div id="mainBody" class="body main-content" aria-label="(N002B) Customer overview" role="complementary" style="padding-top: 50px;">
<div id="Tabs2" class="Tabs topLevel CoachView tab-content CoachView_show" data-eventid="" data-viewid="Tabs2" data-config="config61" data-bindingtype="" data-binding="" data-type="com.ibm.bpm.coach.Snapshot_a30ea40f_cb24_4729_a02e_25dc8e12dcab.Tabs">
<div class="s-tabs with-drop sticky">
<div class="p-tabs-container tabable">
<ul class="p-tabs-ul nav-tabs">
<li class="p-tab-li turq-style active">
<li class="p-tab-li turq-style">
<a class="p-tab" data-toggle="tab" href="#Tabs2-tab1">
<i class="icon-remove"></i>
<span>Items (USD)</span>
<i class="icon-caret-down"></i>
</a>
在上面的html如何选择“
我尝试了以下内容:
.cssSelector(".icon-caret-down")
value = //*[@id='Tabs2']/div[1]/div/ul/li[2]/a/i[2]
它不起作用..
答案 0 :(得分:0)
你可以尝试Explicit wait,
new WebDriverWait(driver,60).until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("#Tabs2 .p-tab > .icon-caret-down"))).click();
以上代码将等待60秒,以获得.icon-caret-down
元素的可见性。