我试图在selenium webdriver中使用C#找到下拉框。尝试与众不同 选项如By.Id,By.XPath,但无法找到元素。以下是HTML代码 同样的。
<div class="chzn-drop" style="left: -9000px; width: 387px; top: 32px;">
<div class="chzn-search">
<input type="text" autocomplete="off" style="width: 352px;" tabindex="5">
</div>
<div class="slimScrollDiv" style="position: relative; overflow: hidden; width: auto;">
<ul class="chzn-results" style="overflow: hidden; width: auto;">
<div class="slimScrollBar" style="background: none repeat scroll 0% 0% rgb(0, 0, 0); width: 15px; position: absolute; top: 0px; opacity: 0.4; display: block; border-radius: 7px; z-index: 99; right: 1px; height: 121.263px;"></div>
<div class="slimScrollRail" style="width: 15px; height: 100%; position: absolute; top: 0px; display: block; border-radius: 7px; background: none repeat scroll 0% 0% rgb(51, 51, 51); opacity: 0.2; z-index: 90; right: 1px;"></div>
</div>
</div>
答案 0 :(得分:0)
尝试By.Css,例如
driver.find(By.Css(".slimScrollDiv"));