Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/reporting-services/3.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
Selenium webdriver 这是一个下拉列表,您能告诉我如何从selenium webdriver的下拉列表中选择第二个或第三个选项吗。默认情况下选择了Mr_Selenium Webdriver - Fatal编程技术网

Selenium webdriver 这是一个下拉列表,您能告诉我如何从selenium webdriver的下拉列表中选择第二个或第三个选项吗。默认情况下选择了Mr

Selenium webdriver 这是一个下拉列表,您能告诉我如何从selenium webdriver的下拉列表中选择第二个或第三个选项吗。默认情况下选择了Mr,selenium-webdriver,Selenium Webdriver,我无法从下拉列表中选择值。你能帮帮我吗 <div id="sbHolder_43830942" class="sbHolder" tabindex="1"> <a id="sbToggle_43830942" class="sbToggle" href="#"/> <a id="sbSelector_43830942" class="sbSelector" href="#">Mr.</a> <ul id="sbOptions

我无法从下拉列表中选择值。你能帮帮我吗

<div id="sbHolder_43830942" class="sbHolder" tabindex="1">
   <a id="sbToggle_43830942" class="sbToggle" href="#"/>
   <a id="sbSelector_43830942" class="sbSelector" href="#">Mr.</a>
   <ul id="sbOptions_43830942" class="sbOptions" style="top: 24px; max-height: 100px; display: none;">
      <li><a class="" href="#Mr" rel="Mr">Mr.</a> </li>`
      <li><a class="" href="#Ms" rel="Ms">Ms.</a></li> 
      <li><a class="" href="#Mrs" rel="Mrs">Mrs.</a></li>
      <li><a class="" href="#Mx" rel="Mx">Mx.</a></li>
   </ul>
</div>

  • `
将rel属性更改为Mrs,Mx,以根据您的要求选择相应的选项

我用上面的代码检查了一下,它工作得很好


希望这对您有所帮助…如果您有任何疑问,请尽快回复。上面是我的代码。。在这里,我没有选择选项。。所有都保存在Tag中试图修复代码格式上面是我的代码。。在这里,我没有选择选项。。所有这些都保存在标签中-在这个屏幕名称下拉列表中,我面临着一个问题。谁能帮帮我吗out@OleManjunath我已经编辑了我上面的回复并添加了代码,请参考…希望它能帮助您const DEFAULT_MAX_INSTANCES=4 exports.config={specs:[//'app/e2e/content/ApplicationDetails.feature''test/e2e/content/SSOPSIT_1444_SanitySingleCustomer.feature'],//要排除的模式。排除:[//'./.github'、//'./node_modules'、///'./test'],maxInstances:parseInt(process.env.MAX_INSTANCES)| |默认_MAX_实例,功能:[{//maxInstances可以覆盖每个功能。因此,如果您有一个内部Selenium//grid,其中只有5个firefox实例可用,则可以确保一次启动的实例不超过//5个。maxInstances:1,//browserName:'chrome'}],sync:true,////日志详细级别:静默|详细|命令|数据|结果|错误日志级别:'verbose',////为日志输出启用颜色。coloredLogs:true,////在命令失败时将屏幕截图保存到给定路径。
//clicks on the drop down box

driver.findElement(By.xpath("//a[@class='sbSelector']")).click();

//select options from drop down box based on rel attribute

driver.findElement(By.xpath("//ul[@class='sbOptions']/li/a[@rel='Ms']")).click();