package de.roko.genalogy.downloader.util; import de.roko.genalogy.downloader.archion.ArchionLoginHelper; import de.roko.genalogy.downloader.tools.ArchionBatchDownloader; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.support.ui.WebDriverWait; import java.time.Duration; class ArchionBatchDownloaderTest { public static WebDriver driver; @BeforeAll static void setup() { String username = "robatkoch"; String password = "PaLiNa2016$$"; driver = new ChromeDriver(); ArchionLoginHelper archionLoginHelper = new ArchionLoginHelper(driver); archionLoginHelper.login(username, password); } @Test void downloadAndStitchPages() { WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10)); String url = "https://www.archion.de/de/viewer/churchRegister/287339?cHash=ca3bf31106a5081448b44947b5d5bd95"; String zielPfad = System.getProperty("user.home") + "/Dokumente/archion"; ArchionBatchDownloader batch = new ArchionBatchDownloader(driver); batch.downloadAndStitchPages( url, // Startseite im Viewer zielPfad, // Zielverzeichnis 8 // Anzahl Seiten ); } @Test void ermittleSeitenAnzahl() throws InterruptedException { String startUrl = "https://www.archion.de/de/viewer/churchRegister/287339?cHash=ca3bf31106a5081448b44947b5d5bd95"; ArchionBatchDownloader batch = new ArchionBatchDownloader(driver); System.out.println("Seitenanzahl: " + batch.ermittleSeitenAnzahl(startUrl)); } @AfterEach void tearDown() { driver.quit(); } }