@@ -14,8 +14,10 @@ import java.time.Duration
14
14
import java.time.LocalDate
15
15
import java.time.format.DateTimeFormatter.ofPattern
16
16
import java.util.concurrent.TimeUnit
17
+ import java.util.concurrent.TimeoutException
17
18
import kotlin.text.RegexOption.IGNORE_CASE
18
19
import org.openqa.selenium.By
20
+ import org.openqa.selenium.PageLoadStrategy
19
21
import org.openqa.selenium.chrome.ChromeDriver
20
22
import org.openqa.selenium.chrome.ChromeOptions
21
23
import org.openqa.selenium.support.ui.ExpectedConditions.elementToBeClickable
@@ -39,6 +41,7 @@ class FantasticoBrochureDownloader(@Value("\${fantastico.url}") private val url:
39
41
options.addArguments(" --window-size=1920,1200" )
40
42
options.addArguments(" --no-sandbox" )
41
43
options.addArguments(" --disable-dev-shm-usage" )
44
+ options.setPageLoadStrategy(PageLoadStrategy .NONE )
42
45
}
43
46
}
44
47
@@ -52,7 +55,7 @@ class FantasticoBrochureDownloader(@Value("\${fantastico.url}") private val url:
52
55
53
56
val driver = ChromeDriver (options)
54
57
55
- val waitDriver = WebDriverWait (driver, Duration .ofSeconds(10 ))
58
+ val waitDriver = WebDriverWait (driver, Duration .ofSeconds(30 ))
56
59
57
60
val brochures =
58
61
htmlDoc
@@ -77,7 +80,13 @@ class FantasticoBrochureDownloader(@Value("\${fantastico.url}") private val url:
77
80
val flippingBookUrl = it.attr(" data-url" )
78
81
79
82
// loading the flipping book
80
- driver.get(flippingBookUrl)
83
+ repeat(3 ) {
84
+ try {
85
+ driver.get(flippingBookUrl)
86
+ } catch (_: TimeoutException ) {
87
+ log.warn(" Retrying loading flipping book due to timeout..." )
88
+ }
89
+ }
81
90
82
91
val downloadSelector =
83
92
By .cssSelector(" a[aria-label=\" Download the flipbook as a PDF file\" ]" )
0 commit comments