1

I am entering data into text fields in a browser via "type" command. In order for the Save and Cancel buttons to be activated (not grayed out), I need to click in another text field to change focus. This works manually, but I can't seem to figure out how to do it programmatically. I have tried click, clickAt, doubleClick, mouseOver/click/mouseOUt, mouseDown/mouseUp, focus, fireEvent ... all without luck. Thanks for any suggestions!

4

1 回答 1

6

跳出输入字段是否启用按钮?如果是这样,也许你可以这样做:

WebElement element = driver.findElement(By.id("your_input_field"));
element.sendKeys(Keys.TAB);
于 2013-02-01T16:25:26.397 回答