我有这行代码:
final WebElement button = driver.findElement(By.tagName("button"));
Run Code Online (Sandbox Code Playgroud)
现在,如何在按住元键的情况下单击该按钮?
Mad*_*d0g 12
嗯..我不完全确定java,但在C#中这是用ActionBuilder完成的 -
new Actions(Browser).KeyDown(Keys.Shift).Click(element).KeyUp(Keys.Shift).Perform();
Run Code Online (Sandbox Code Playgroud)
Gor*_*sic 12
根据Madd0g,java代码看起来像这样:
Actions shiftClick = new Actions(driver);
shiftClick.keyDown(Keys.SHIFT).click(element).keyUp(Keys.SHIFT).perform();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7552 次 |
| 最近记录: |