硒滚动

时间:2020-07-17 09:11:31

标签: java selenium-webdriver screenshot

我想根据输入的关键字来截取所有相关搜索结果建议的屏幕截图,但又是另一幅,我该如何在硒中做到这一点?

    for(int i=1; i<=sheet.getLastRowNum(); i++) { 
    //Import data for company names. 
    cell = sheet.getRow(i).getCell(1); 
    cell.setCellType(CellType.STRING); 
    Thread.sleep(3000);
    //Here i'm reading and writing inputs from excel sheet
    WebElement SearchBar = driver.findElement(By.className("search-global-typeahead__input"));
    SearchBar.sendKeys(cell.getStringCellValue(), Keys.ENTER);
    Thread.sleep(3000);
    wait = new WebDriverWait(driver,30);
    SearchBar.submit();

1 个答案:

答案 0 :(得分:0)

您需要在硒中使用Ashot Api来获取整个页面的屏幕截图。

How to take full page Screenshot of a scrollable webpage using Selenium WebDriver with Java?此链接将有助于解决此问题