Skip to content

Commit

Permalink
wait until preloader is not visible
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanBratanov committed Dec 4, 2023
1 parent fce5a06 commit 8a1a1d8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ The following environment variables need to be set prior to running:
* DB_PASSWORD
* GOOGLE_API_KEY
* CLOUDINARY_API_SECRET
* CHROMIUM_BINARY (path to any Chromium-based browser binary)
* CHROMIUM_BINARY (path to any Chromium-based browser binary if not installed in a default location)

Navigate to <http://localhost:8080/swagger-ui.html> to check the API documentation and
test the endpoints.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import org.openqa.selenium.By
import org.openqa.selenium.Dimension
import org.openqa.selenium.chrome.ChromeDriver
import org.openqa.selenium.chrome.ChromeOptions
import org.openqa.selenium.support.ui.ExpectedConditions
import org.openqa.selenium.support.ui.ExpectedConditions.elementToBeClickable
import org.openqa.selenium.support.ui.WebDriverWait
import org.springframework.beans.factory.annotation.Value
Expand Down Expand Up @@ -154,6 +155,7 @@ class FantasticoBrochureDownloader(
private fun clickBrochure(dataId: String, waitDriver: WebDriverWait) {
log.info("Trying to click brochure with data-id: $dataId")
val cssSelector = By.cssSelector("div.hold-options[data-id='$dataId']")
waitDriver.until(ExpectedConditions.invisibilityOfElementLocated((By.className("preloader"))))
waitDriver.until(elementToBeClickable(cssSelector)).click()
// sleep a bit after clicking
TimeUnit.SECONDS.sleep(2)
Expand Down

0 comments on commit 8a1a1d8

Please sign in to comment.