feat(playwright): 添加浏览器配置类并集成Playwright

新增BrowserConfig配置类,用于创建和管理Playwright实例。
移除DesktopApplication中冗余的UI示例代码和旧版PlaywrightService。
添加FtbCrawlNetBase接口及其实现类FtbCrawlNetMt,用于执行Cookie拦截逻辑。更新PlatformSelectionView以支持美团平台的连接功能,并通过SpringContext获取爬虫服务。
调整module-info.java以开放和导出新增模块包路径,确保Spring能够正确注入依赖。
```
This commit is contained in:
wangchunxiang
2025-10-13 16:57:52 +08:00
parent a5fcb54815
commit 9fa2e10049
8 changed files with 170 additions and 209 deletions

View File

@@ -1,14 +1,7 @@
package com.fantaibao;
import com.fantaibao.page.LoginView;
import com.fantaibao.service.PlaywrightService;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.TextArea;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -36,57 +29,7 @@ public class DesktopApplication extends Application {
public void start(Stage primaryStage) {
// 直接启动登录界面
new LoginView(primaryStage);
/*
primaryStage.setTitle("饭太煲爬虫桌面程序");
textArea = new TextArea();
textArea.setPrefRowCount(20);
textArea.setPrefColumnCount(50);
textArea.setEditable(false);
Button playwrightButton = new Button("运行Cookie拦截示例");
playwrightButton.setOnAction(e -> runPlaywrightCookieExample());
Button loginButton = new Button("运行登录示例");
loginButton.setOnAction(e -> runLoginExample());
VBox vBox = new VBox(10, playwrightButton, loginButton, textArea);
vBox.setPadding(new Insets(10));
Scene scene = new Scene(vBox, 800, 600);
primaryStage.setScene(scene);
primaryStage.setOnCloseRequest(e -> {
if (applicationContext != null) {
applicationContext.close();
}
Platform.exit();
});
primaryStage.show();
*/
}
/*
private void runPlaywrightCookieExample() {
appendText("开始运行Playwright Cookie拦截示例...\n");
Thread thread = new Thread(() ->
playwrightService.interceptCookieExample(this::appendText)
);
thread.setDaemon(true);
thread.start();
}
private void runLoginExample() {
appendText("开始运行登录示例...\n");
Thread thread = new Thread(() ->
playwrightService.loginExample(this::appendText)
);
thread.setDaemon(true);
thread.start();
}
private void appendText(String text) {
Platform.runLater(() -> textArea.appendText(text + "\n"));
}*/
@Override
public void stop() {