Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.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
Java 从下拉列表中第二次选择元素时无法定位元素_Java_Selenium - Fatal编程技术网

Java 从下拉列表中第二次选择元素时无法定位元素

Java 从下拉列表中第二次选择元素时无法定位元素,java,selenium,Java,Selenium,***强文本***在从下拉列表中第二次选择元素时找不到元素 我试过等待 String elementSelector = "//*[@id='approverPicker" + iApproversCount + "-list']//div[contains(concat(' ','x-combo-list-item', ' '), 'x-combo-list-item') and contains(text(),

***强文本***在从下拉列表中第二次选择元素时找不到元素

我试过等待

 String elementSelector = "//*[@id='approverPicker"
                    + iApproversCount
                    + "-list']//div[contains(concat(' ','x-combo-list-item', ' '), 'x-combo-list-item') and contains(text(),'"
                    + name + "')]";

driver.findElement(By.xpath(elementSelector)).click();
第一次选择元素,但当我在添加第一个元素后尝试第二次选择时,它抛出无法定位元素

以下是html代码:

<div class="x-combo-list-inner" id="approverPicker1-list" style="" xpath="1">   <div class="x-combo-list-item" style="" ext:qtip="test@gmail.com">app,auto</div>    <div class="x-combo-list-item" style="text-align:left;" 
 ext:qtip="test@gmail.com">autoi, compl</div>
<div class="x-combo-list-item" style="text-align:left;" ext:qtip="test@gmail.com">autoEmployee2, autoEmployee2</div>    
<div class="x-combo-list-item x-combo-selected" style="text-align:left;" ext:qtip="test@gmail.com">autoEmployee, autoEmployee</div> <div class="x-combo-list-item" style="text-align:left;" ext:qtip="test@.com">autoEmployeeui, autoEmployeeui</div>   <div class="x-combo-list-item" style="text-align:left;" ext:qtip="test@gmail.com">bob, sponge</div> <div class="x-combo-list-item" style="text-align:left;" 
app、自动识别、compl
自动雇员2,自动雇员2

autoEmployee,autoEmployeeui,autoEmployeeui鲍勃,海绵你有html的快照吗?没有html源代码很难说。尝试使用Select=newselect(WebElement);select.selectBy…它可以在调试模式下找到下拉列表,但不在运行模式下我无法在此添加屏幕截图复制粘贴HTML代码请:)