2014-01-24 43 views
0

有人請建議我如何在硒web驅動程序中測試工具提示文本。 我試圖找到,但它不是工作:如何檢查selenium web驅動程序中的工具提示?

Actions action = new Actions(driver); 
     WebElement web1 = driver.findElement(By.id("txtEmailId")); 
     action.moveToElement(web1).click().build().perform(); 
+0

如果它然後鼠標懸停刀尖嘗試action.moveToElement(WEB1).build()執行(); – Anuragh27crony

回答

0

使用的Java機器人的UI交互;機器人在這裏用於控制鼠標動作。

WebElement targetElement = driver.findElement(By.id("txtEmailId")); 
Point coordinates = targetElement.getLocation(); 
Robot robot = new Robot(); 
robot.mouseMove(coordinates.getX(), coordinates.getY() + 65); //Number 65 should vary 

Thread.sleep(3000); 
String tooltip = driver.findElement(By.id("txtEmailId"")).getAttribute("title"); 
System.out.println(tooltip); 
相關問題