我目前正在測試我的應用程序的GUI,我想知道是否有可能將焦點設置爲WebElement?關注WebElement?
我使用Selenium 2.0和webdriver。
所以我在尋找類似的東西:driver.findElement(xxxx).setfocus();
謝謝。
編輯: 我alreardy測試之類的技巧性的東西
// getting the element WebElement
eSupplierSuggest = driver.findElement(By.xpath("..."));
//get le location and click
Point location = eSupplierSuggest.getLocation();
new Actions(driver).moveToElement(eSupplierSuggest, location.x, location.y).click();
//or
//directly perform
new Actions(driver).moveToElement(eSupplierSuggest).click().perform();
我紅色的地方,點擊焦點的元素,但對我來說,沒有什麼工作。笑
PS:這是原帖的子問題Click on a suggestbox, webdriver
使用任何框架?或只是HTML CSS JS應用程序 – daemonThread
@daemon:是的,我使用Selenium 2,我會在問題上添加它。我的錯。 – e1che
你能告訴我,你爲什麼需要關注嗎?它是否類似於您正在測試的自我暗示盒? – Hemanth