Java 获取不可单击的异常(元素<;选择类=";表单控件";名称=";状态下拉列表";在点处不可单击)

Java 获取不可单击的异常(元素<;选择类=";表单控件";名称=";状态下拉列表";在点处不可单击),java,selenium,selenium-webdriver,testng,Java,Selenium,Selenium Webdriver,Testng,1.事实上,在过去的两天里,我试图解决这个异常,但它仍然不起作用。所以,即使我使用的是正确的xpath,但我仍然会遇到这个异常,请说明可能存在的问题 我正在使用下面的xPath 对于这个xpath,我得到了一个异常,我在test案例(test(priority=4))中使用的这个xpath 这里也不例外 @Test(priority = 4) public void deliveryChannel() throws InterruptedException { wait

1.事实上,在过去的两天里,我试图解决这个异常,但它仍然不起作用。所以,即使我使用的是正确的xpath,但我仍然会遇到这个异常,请说明可能存在的问题

  • 我正在使用下面的xPath
  • 对于这个xpath,我得到了一个异常,我在test
    案例(test(priority=4))中使用的这个xpath

    这里也不例外

    @Test(priority = 4)
        public void deliveryChannel() throws InterruptedException {
            wait = new WebDriverWait(driver, 10);
            
            String getDeliveryChannel = sftpCon.deliveryChannel("Search Criteria", 0);
        //WebElement deliveryChannelDropDown = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(prop.getProperty("deliveryChannel"))));
            WebElement deliveryChannelDropDown = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(prop.getProperty("deleverysize"))));
            System.out.println("Delevery Channel Text = "+deliveryChannelDropDown.getText());
            select = new Select(deliveryChannelDropDown);
            driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
            List<WebElement> listSelectApp = select.getOptions();
            for (int i = 0; i < listSelectApp.size(); i++) {
                String app = listSelectApp.get(i).getText();
                if (getDeliveryChannel.contains(app)) {
                    listSelectApp.get(i).click();
                }
            }
        }
    
        @Test(priority = 5, retryAnalyzer = com.brcc.tool.RetryFailedTestCases.RetryTestCases.class)
        public void getPrintStatus() throws InterruptedException {
            wait = new WebDriverWait(driver, 10);
            String printStatus = sftpCon.deliveryChannel("Search Criteria", 1);
            WebElement printStatusDropDown = wait
                    .until(ExpectedConditions.visibilityOfElementLocated(By.xpath(prop.getProperty("printStatus"))));
            select = new Select(printStatusDropDown);
            List<WebElement> listSelectApp = select.getOptions();
            for (int i = 0; i < listSelectApp.size(); i++) {
                String app = listSelectApp.get(i).getText();
                if (printStatus.contains(app)) {
                    listSelectApp.get(i).click();
                }
            }
        }
    
    @测试(优先级=4)
    public void deliveryChannel()引发InterruptedException{
    等待=新的WebDriverWait(驱动程序,10);
    字符串getDeliveryChannel=sftpCon.deliveryChannel(“搜索条件”,0);
    //WebElement deliveryChannelDropDown=wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(prop.getProperty(“deliveryChannel”))));
    WebElement deliveryChannelDropDown=wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(prop.getProperty(“deleverysize”)));
    System.out.println(“Delevery Channel Text=“+deliveryChannelDropDown.getText());
    选择=新选择(DeliveryChannel下拉列表);
    driver.manage().timeouts().implicitlyWait(10,TimeUnit.SECONDS);
    List listSelectApp=select.getOptions();
    对于(int i=0;i
    下面是我的html元素

    <div class="col-md-8">
    <statusdropdown id="deliveryChannelField" ng-reflect-selected-status="print" ng-reflect-optional-status="[object Object]" ng-reflect-return-key="delivery_channel_name" ng-reflect-display-key="delivery_channel_description">
    <select class="form-control" name="statusDropdown">
    <!--bindings={  "ng-reflect-ng-for-of": "[object Object]"
    }-->
    <option value="print" ng-reflect-value="print">Print</option>
    </select>
    </statusdropdown>
    </div>
    
    
    印刷品
    
    我认为您可以使用
    元素来实现可伸缩性()
    ,而不是
    元素的可视性()。如果这不起作用,那么我认为该网站有问题,您必须编辑您的问题以提供该网站。

    您可以为您尝试插入的特定元素共享html元素dom吗?请检查我已添加html元素使用select时,您必须使用带有select标记的元素。在select=newselect(名称)中使用name=“statusDropdown”元素。
    @Test(priority = 4)
        public void deliveryChannel() throws InterruptedException {
            wait = new WebDriverWait(driver, 10);
            
            String getDeliveryChannel = sftpCon.deliveryChannel("Search Criteria", 0);
        //WebElement deliveryChannelDropDown = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(prop.getProperty("deliveryChannel"))));
            WebElement deliveryChannelDropDown = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(prop.getProperty("deleverysize"))));
            System.out.println("Delevery Channel Text = "+deliveryChannelDropDown.getText());
            select = new Select(deliveryChannelDropDown);
            driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
            List<WebElement> listSelectApp = select.getOptions();
            for (int i = 0; i < listSelectApp.size(); i++) {
                String app = listSelectApp.get(i).getText();
                if (getDeliveryChannel.contains(app)) {
                    listSelectApp.get(i).click();
                }
            }
        }
    
        @Test(priority = 5, retryAnalyzer = com.brcc.tool.RetryFailedTestCases.RetryTestCases.class)
        public void getPrintStatus() throws InterruptedException {
            wait = new WebDriverWait(driver, 10);
            String printStatus = sftpCon.deliveryChannel("Search Criteria", 1);
            WebElement printStatusDropDown = wait
                    .until(ExpectedConditions.visibilityOfElementLocated(By.xpath(prop.getProperty("printStatus"))));
            select = new Select(printStatusDropDown);
            List<WebElement> listSelectApp = select.getOptions();
            for (int i = 0; i < listSelectApp.size(); i++) {
                String app = listSelectApp.get(i).getText();
                if (printStatus.contains(app)) {
                    listSelectApp.get(i).click();
                }
            }
        }
    
    <div class="col-md-8">
    <statusdropdown id="deliveryChannelField" ng-reflect-selected-status="print" ng-reflect-optional-status="[object Object]" ng-reflect-return-key="delivery_channel_name" ng-reflect-display-key="delivery_channel_description">
    <select class="form-control" name="statusDropdown">
    <!--bindings={  "ng-reflect-ng-for-of": "[object Object]"
    }-->
    <option value="print" ng-reflect-value="print">Print</option>
    </select>
    </statusdropdown>
    </div>