Selenium webdriver Selenium WebDriver的Select功能面临问题

Selenium webdriver Selenium WebDriver的Select功能面临问题,selenium-webdriver,Selenium Webdriver,在自动化流程中,我的脚本正确识别下拉对象,并根据传递的值进行选择 public NewV1ProjectPage selectResponsiblePerson(String responsiblePersonValue){ WebElement responsiblePerson = (new WebDriverWait(driver, 10)) .until(ExpectedConditions.presenceOfElementLocated(By.na

在自动化流程中,我的脚本正确识别下拉对象,并根据传递的值进行选择

public NewV1ProjectPage selectResponsiblePerson(String responsiblePersonValue){
    WebElement responsiblePerson = (new WebDriverWait(driver, 10))
              .until(ExpectedConditions.presenceOfElementLocated(By.name("responsible_person_sap_id")));
    new Select(responsiblePerson).selectByVisibleText(responsiblePersonValue);
    return this;
}
但当它移动到下一个下拉列表时,问题就出现了,一旦它移动到新的下拉列表,在上一个下拉列表中选择的值就会被取消选择

我不确定是什么原因导致该值从此下拉列表中消失,其余所有下拉列表都正常工作


请有人帮忙

试试下面的代码可能会对您有所帮助

WebElement element = driver.findElement(By.id(""));
Select sortby = new Select(element);
List<WebElement> options =sortby.getOptions();
for (WebElement element1 : options) {
    // given the value in data place
if (element1.getText().equals(data)) {
         element1.click();
     Thread.sleep(5000);
    }
}
WebElement=driver.findElement(By.id(“”));
Select sortby=新选择(元素);
List options=sortby.getOptions();
for(WebElement元素1:选项){
//给定数据位置中的值
if(element1.getText().equals(数据)){
元素1.单击();
睡眠(5000);
}
}

它已在使用“我的代码”选择值。。问题是,当驱动程序移动到下一个下拉列表时,值会自动取消选择。是的,仅尝试了。。有时有效有时无效。你到底想让我把它放在什么地方等等。。它不再工作。在下拉列表中选择一个值后,您将提供一些线程睡眠,然后继续下一个下拉列表选择。