如何使用Selenium WebDriver在鼠标悬停时获取工具提示文本

Rag*_*ghu 5 selenium tooltip selenium-webdriver

将鼠标悬停在图标工具提示上后,我无法获得工具提示文本。我需要获取工具提示文本,这是html代码。

    <a class="tooltip" onclick="SocialAuth.showOpenIDLoginWindow('google');_gaq.push(['_trackEvent','LoginForm','google-login','google login was clicked']);" href="javascript:void(0);"><span>We dont store your password or access your contacts on your Google account.</span><img class="social" height="39" width="40" src="/images/login/google.png"/>
Run Code Online (Sandbox Code Playgroud)

Hem*_*nth 2

使用以下代码行从元素中获取工具提示文本。

String toolTipText = driver.findElement(By.id(element's id)).getAttribute("title");
Run Code Online (Sandbox Code Playgroud)