Wait for Download to finish in selenium webdriver JAVA

后端 未结 13 1677
醉话见心
醉话见心 2020-12-01 14:38

Once clicking a download button, files will be downloaded. Before executing next code, it needs to wait until the download completes.

My code looks like this:

<
13条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-01 14:53

    The below code is working fine for me.

    Also no warning will be as I used Generic type and Duration as recommended.

    File file = new File("C:\chromedriver_win32.zip"); FluentWait wait = new FluentWait(driver).withTimeout(Duration.ofSeconds(25)).pollingEvery(Duration.ofMillis(100)); wait.until( x -> file.exists());

提交回复
热议问题