WebElement#getScreenShotAs(OutputType.File) not working

前端 未结 4 545
时光取名叫无心
时光取名叫无心 2021-01-21 05:08

I am trying to use WebElement#getScreenShotAs(OutputType.FILE) feature added in selenium webdriver 2.47.0 version on Firefox Browser Code

public         


        
4条回答
  •  南方客
    南方客 (楼主)
    2021-01-21 05:40

    The getScreenShotAs() method is not defined as part of the WebElement interface. Rather, it is included as part of the TakesScreenshot interface. If you want to take a screenshot and save it to a file, try the following:

    File file = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
    

提交回复
热议问题