Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/402.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何从div中找到下拉列表?_C#_Javascript_Xml_Xpath_Selenium Webdriver - Fatal编程技术网

C# 如何从div中找到下拉列表?

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

下面是一些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></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>