选择复选框时在katalon中获取过时的元素异常

时间:2019-12-06 13:10:40

标签: java selenium selenium-webdriver katalon-studio

任何人都可以帮我解决相同的异常,因为我在运行我的代码时五分之二会得到此异常

public selectTags(int tags){
    WebDriver driver = DriverFactory.getWebDriver()
    for(int i=1; i<=tags; i++){
        WebElement elementCheckBox = driver.findElement(By.cssSelector('div.v-scrollable.v-table-body-wrapper.v-table-body div:nth-child(1) table tbody tr:nth-child('+i+') td:nth-child(1) input'))
        if(!elementCheckBox.isSelected()){
            elementCheckBox.click()
            WebUI.delay(1)
        }
    }
}

HTML代码: enter image description here 如果有人可以帮上忙会很有帮助吗?

1 个答案:

答案 0 :(得分:0)

您为什么不共享HTML元素? 这可能有助于解决问题。

我想您应该在单击之前和单击之前使用延迟

html_theme = 'sphinx_rtd_theme'
html_static_path = ['_static']
html_logo = 'logo.svg'
html_theme_options = {
    'logo_only': True,
    'display_version': False,
}