向文件上传部分添加无效文件类型后,验证消息将显示为工具提示,即使在使用moveToElement()后,我也无法验证工具提示。Selenium moveToElement()读取工具提示不起作用
这里是我用来做工具提示可见的代码
`driver.findElement(By.xpath(""//input[@type='file']"").sendKeys(invalidLicenseFileType.txt);
Actions actions = new Actions(driver);
actions.moveToElement(//*[contains(@class, 'fieldlabel-content')]).build().perform();`
HTML代码:
<div class="fieldlabel-content">
<label class="fileinput fileinput--invalid">
<div class="fileinput-cell fileinput-cell-input">
<input placeholder="Choose a .license file..." accept=".license" value="" tabindex="0" type="file">
<div class="fileinput-description">
File:
<span class="fileinput-description-file">
<span class="icon fa fa-file-text-o"></span>
invalidLicenseFileType.txt
</span>
</div>
</div>
<div class = "popup popup--theme-error popup--position-top popup--hover" style="top: 131px; left: 399px;">Validation message for uploading invalid file type.</div>
</label>
你能告诉我们HTML吗? – Buaban
@BuabanI已将HTML添加到问题 – SKV
您可以在操作之前向我们提供错误消息和更多的java代码吗? – Buaban