【发布时间】:2018-12-23 14:55:56
【问题描述】:
WebElement element= driver.findElement(By.id("jform_email-lbl"));
Actions mouseOver = new Actions(driver);
mouseOver.moveToElement(element).perform();
//String toolTipText = element.getText();
String toolTipElement = driver.findElement(By.id("jform_email-lbl")).getAttribute("title data-original-title");
它给了我null 的价值。
HTML:
<label id="jform_email-lbl" for="jform_email" class="hasTooltip required" title="" data-original-title="<strong>Email Address</strong><br />Please enter the email address associated with your User account.<br />A verification code will be sent to you. Once you have received the verification code, you will be able to choose a new password for your account.">
Email Address
<span class="star"> *</span>
</label>
【问题讨论】:
-
你可以试试
getAttribute("data-original-title");
标签: java selenium xpath tooltip webdriverwait