gpt4 book ai didi

javascript - 预期条件失败 : waiting for element to be clickable for element containing style ="display: none;"

转载 作者:行者123 更新时间:2023-12-01 01:58:03 25 4
gpt4 key购买 nike

<div class="col-xs-3" xpath="1">
<label>Service Duration in mins</label>
<span class="k-widget k-numerictextbox k-overwrite" style="">
<span class="k-numeric-wrap k-state-default">
<input type="text" class="k-formatted-value k-overwrite k-input" title="500" tabindex="0" role="spinbutton" aria-valuemin="0" aria-valuenow="500" aria-disabled="false" style="display: inline-block;">
<input class="k-overwrite k-input" data-val="true" data-val-number="The field DurationInMins must be a number." data-val-required="The DurationInMins field is required." id="DurationInMins" min="0" name="DurationInMins" type="text" value="0" data-role="numerictextbox" role="spinbutton" aria-valuemin="0" style="display: none;" aria-valuenow="500" aria-disabled="false">
<span class="k-select">
<span unselectable="on" class="k-link k-link-increase" aria-label="Increase value" title="Increase value">
<span unselectable="on" class="k-icon k-i-arrow-60-up">
</span>
</span>
<span unselectable="on" class="k-link k-link-decrease" aria-label="Decrease value" title="Decrease value">
<span unselectable="on" class="k-icon k-i-arrow-60-down">
</span>
</span>
</span>
</span>
</span>
<script>
kendo.syncReady(function(){jQuery("#DurationInMins").kendoNumericTextBox({"format":"{0:n0}"});});
</script>
</div>

我尝试在旋转按钮(带有递增和递减箭头的文本框)中输入值。下面的代码抛出一个错误:

Expected condition failed:waiting for element to be clickable.

谁能帮我解决这个错误...

提前致谢...

WebElement ele5=driver.findElement(By.xpath("//input[@id='DurationInMins']"));
JavascriptExecutor executor1=(JavascriptExecutor)driver;
executor1.executeScript("arguments[0].click()",ele5);
WebDriverWait wait1=new WebDriverWait(driver,10);
wait1.until(ExpectedConditions.elementToBeClickable(ele5));
ele5.clear();
ele5.sendKeys("45");
//Thread.sleep(2000);

最佳答案

根据您共享的 HTML,所需的元素(即输入字段)具有属性 style="display: none;"。因此,要将字符序列发送到输入字段,您可以使用以下解决方案:

WebElement ele5 = driver.findElement(By.xpath("//input[@class='k-overwrite k-input' and @id='DurationInMins']"));
((JavascriptExecutor)driver).executeScript("arguments[0].removeAttribute('style')", ele5)
ele5.clear();
ele5.sendKeys("45");

关于javascript - 预期条件失败 : waiting for element to be clickable for element containing style ="display: none;",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50848586/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com