Monday, May 16, 2016

Verifying ToolTip information by enabling javascript in browser


/**

* Verifying ToolTip information - Must enable the javascript in browser


*

* @param driver

* @param objectLocator

* @return


*/

public String toolTipInformation(WebDriver driver, String objectLocator) {

WebElement element;
String toolTipMsg = "";

try {
element = findElement(driver, objectLocator);
Actions builder = new Actions(driver);
builder.moveToElement(element).build().perform();
toolTipMsg = driver.findElement(By.id("tooltip")).getText();

} catch (Exception e) {
e.printStackTrace();
}
return toolTipMsg;
}

Note : example to enable javascript

FirefoxProfile profile = new FirefoxProfile(); profile.setPreference("javascript.enabled", false); - See more at: http://software-testing-tutorials-automation.blogspot.in/2015/01/how-to-disable-javascript-using-custom.html#sthash.NeR3YIhK.dpuf
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("javascript.enabled", true);

 

No comments:

Post a Comment