C# 如何从div中找到下拉列表?
下面是一些html代码C# 如何从div中找到下拉列表?,c#,javascript,xml,xpath,selenium-webdriver,C#,Javascript,Xml,Xpath,Selenium Webdriver,下面是一些html代码 <div id="ServiceTypeId_chzn" class="chzn-container chzn-container-single" style="width: 389px;"> <a class="chzn-single" tabindex="-1" href="javascript:void(0)"> <span>Choose an Option</span> <div> <b>&l
<div id="ServiceTypeId_chzn" class="chzn-container chzn-container-single" style="width: 389px;">
<a class="chzn-single" tabindex="-1" href="javascript:void(0)">
<span>Choose an Option</span>
<div>
<b></b>
</div>
但是我找不到它。XPath区分大小写:
<div id="ServiceTypeId_chzn" class="chzn-container chzn-container-single" style="width: 389px;">
<a class="chzn-single" tabindex="-1" href="javascript:void(0)">
<span>Choose an Option</span>
<div>
<b></b>
</div>
id=服务类型id\u chzn
//div[@Id='ServiceTypeId\u chzn']
您的代码中应该是://div[@id='ServiceTypeId\u chzn']。试着发布3行以上的内容。你想让我写完整的代码吗???你怎么知道你找不到元素,你有ServiceTypeId_chzn点击事件的监听器吗?我是新来的selenium,对监听器一无所知。以及如何应用它。您好,先生,解决方案可能是我用CW编写它,这和您的XPath有什么关系?这仍然是错误的。
<div id="ServiceTypeId_chzn" class="chzn-container chzn-container-single" style="width: 389px;">
<a class="chzn-single" tabindex="-1" href="javascript:void(0)">
<span>Choose an Option</span>
<div>
<b></b>
</div>