更新时间:2023-11-13 09:45:22
必须先扩充 RemoteWebDriver
才能使用截图功能。正如您已经发现的那样,尝试在没有扩充的情况下进行投射会导致异常。
The RemoteWebDriver
must be augmented before you can use the screenshot capability. As you have no doubt already found, attempting to cast without augmenting results in an exception.
WebDriver driver = new RemoteWebDriver( ... );
driver = new Augmenter().augment( driver );
( (TakesScreenshot)driver ).getScreenshotAs( ... );