format
This commit is contained in:
parent
9174a4cc40
commit
a393653497
87
dependency-reduced-pom.xml
Normal file
87
dependency-reduced-pom.xml
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>com.ets</groupId>
|
||||||
|
<artifactId>ets-playwright</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.14.0</version>
|
||||||
|
<configuration>
|
||||||
|
<release>25</release>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
<artifactId>exec-maven-plugin</artifactId>
|
||||||
|
<version>3.5.0</version>
|
||||||
|
<configuration>
|
||||||
|
<mainClass>com.ets.scraper.EtsScraper</mainClass>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<version>3.5.2</version>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
|
<version>3.6.0</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>shade</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<transformers>
|
||||||
|
<transformer>
|
||||||
|
<mainClass>com.ets.scraper.EtsScraper</mainClass>
|
||||||
|
</transformer>
|
||||||
|
</transformers>
|
||||||
|
<filters>
|
||||||
|
<filter>
|
||||||
|
<artifact>*:*</artifact>
|
||||||
|
<excludes>
|
||||||
|
<exclude>META-INF/*.SF</exclude>
|
||||||
|
<exclude>META-INF/*.DSA</exclude>
|
||||||
|
<exclude>META-INF/*.RSA</exclude>
|
||||||
|
</excludes>
|
||||||
|
</filter>
|
||||||
|
</filters>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter</artifactId>
|
||||||
|
<version>5.12.1</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>junit-jupiter-params</artifactId>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<maven.compiler.target>25</maven.compiler.target>
|
||||||
|
<maven.compiler.source>25</maven.compiler.source>
|
||||||
|
<playwright.version>1.55.0</playwright.version>
|
||||||
|
</properties>
|
||||||
|
</project>
|
||||||
@ -206,8 +206,7 @@ public class EtsScraper {
|
|||||||
System.out.println("[*] Clicking export button...");
|
System.out.println("[*] Clicking export button...");
|
||||||
// 设置下载目录
|
// 设置下载目录
|
||||||
// 点击主导出按钮打开对话框,再用 JS click 触发对话框内导出按钮
|
// 点击主导出按钮打开对话框,再用 JS click 触发对话框内导出按钮
|
||||||
Download dl = page.waitForDownload(
|
Download dl = page.waitForDownload(new Page.WaitForDownloadOptions().setTimeout(300000),
|
||||||
new Page.WaitForDownloadOptions().setTimeout(300000),
|
|
||||||
() -> {
|
() -> {
|
||||||
page.locator("#Export_ThreeBillList_Button").first().click();
|
page.locator("#Export_ThreeBillList_Button").first().click();
|
||||||
sleep(2000);
|
sleep(2000);
|
||||||
@ -227,14 +226,6 @@ public class EtsScraper {
|
|||||||
}
|
}
|
||||||
screenshot(page, "after_export");
|
screenshot(page, "after_export");
|
||||||
System.out.println("[+] Query and export completed!");
|
System.out.println("[+] Query and export completed!");
|
||||||
|
|
||||||
String content = page.textContent("body");
|
|
||||||
if (content != null) {
|
|
||||||
String preview = content.length() > 500
|
|
||||||
? content.substring(0, 500) + ".."
|
|
||||||
: content;
|
|
||||||
System.out.println("[+] Page content preview:\n" + preview);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
System.out.println("[-] Login failed. Check screenshots/ for debugging.");
|
System.out.println("[-] Login failed. Check screenshots/ for debugging.");
|
||||||
screenshot(page, "login_failed");
|
screenshot(page, "login_failed");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user