出现不可点击的异常(元素"<选择类="表单控件"名称="statusDropdown">不可点击) [英] getting Not clickable exception (Element &lt;select class=&quot;form-control&quot; name=&quot;statusDropdown&quot;&gt; is not clickable at point)

查看:194
本文介绍了出现不可点击的异常(元素"<选择类="表单控件"名称="statusDropdown">不可点击)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

1.实际上是最近2天,我试图解决此异常,但仍然无法正常工作.因此,即使我使用的是正确的xpath,但仍遇到此异常,请提出可能的问题.

1.Actually last 2days im trying to solve this exception but still it' not working. So please suggest what could be the issue even if I'm using correct xpath but i'm still getting this exception.

  1. 我在xPath以下使用

deliveryChannel=//statusdropdown[@id="deliveryChannelField"]//select  

对于这个xpath我正在获取异常,我在测试case (Test(priority = 4))

for this xpath i'm getting exception , this Xpath i'm using in test case (Test(priority = 4))

printStatus = //statusdropdown[@id="releaseStatusDropDown"]//select

这里没有例外

@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();
            }
        }
    }

下面是我的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>

推荐答案

我认为您可以使用elementToBeClickable(),而不是visibilityOfElementLocated().如果这不起作用,那么我认为该网站有问题,您还必须编辑问题以提供该网站.

Instead of visibilityOfElementLocated(), I think you could use elementToBeClickable(). If this doesn't work, then I think there's something with that website and you'll have to edit your question to provide the website as well.

这篇关于出现不可点击的异常(元素"<选择类="表单控件"名称="statusDropdown">不可点击)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆