我可以点击的人,点击,什么都没有发生,即行动是禁用的。但是,将显示工具提示。只有当我们集中在按钮上时,工具提示才会出现。
该按钮的html如下:
<button type="button" style="color:#ffffff;" rel="rel-517347" data-toggle="popover" data-animation="true" data-placement="top" data-html="true" data-trigger="hover" data-content="<span class='text-center'>
<div>Ride can only be edited before </div><div>1 hour of pickup time.</div>
</span>" class="btn btn-default disbleBtn width_100" data-original-title="" title="">Edit Ride</button>前面只能编辑Ride的地方是工具提示。
当工具提示不断被销毁时,我如何验证它的文本。
注意,isEnabled()函数在这里返回true,因为我可以单击按钮,但没有发生任何操作。
是否有任何方法可以验证按钮的类,即btn -默认的disbleBtn width_100?它有什么功能或方法吗?
发布于 2018-09-17 11:04:13
我想你应该悬停而不是点击按钮。当悬停工具提示显示,并比您单击立即和工具提示消失。手动使用铬devtools,打开devtools-> sources选项卡,在按钮上悬停,然后按F8暂停,然后检查工具提示元素。在获得工具提示选择器之后,尝试下面的代码:
new Actions(driver).moveToElement(buttonElement).perform();
String tooltipText = new WebDriverWait(driver, 10)
.until(ExpectedConditions.visibilityOfElementLocated(toolTipLocator).getText();
//Verify或者试试这个:
new Actions(driver).moveToElement(buttonElement).perform();
new WebDriverWait(driver, 10)
.until(ExpectedConditions.textToBePresentInElementLocated(toolTipLocator, textToVerify)https://stackoverflow.com/questions/52364966
复制相似问题