create gpt.ts

This commit is contained in:
nobug
2023-12-10 22:58:03 +08:00
parent ae577346b4
commit 5622856f33
2 changed files with 26 additions and 1 deletions

26
gpt.ts Normal file
View File

@ -0,0 +1,26 @@
import { Builder, By, Capabilities, WebDriver } from 'selenium-webdriver';
import waitAnyKey from './waitAnyKey';
(async function secondTest() {
let driver: WebDriver | null = null;
try {
// Selenium Server URL (Assuming your Selenium Server is running on localhost at port 4444)
// http://150.230.239.12:7900/?autoconnect=1&resize=scale&password=secret
const seleniumServerUrl = "http://150.230.239.12:4444/wd/hub";
const capabilities = Capabilities.firefox();
// 创建一个 WebDriver 实例
driver = new Builder()
.usingServer(seleniumServerUrl)
.withCapabilities(capabilities)
.build();
} catch (e) {
console.log(e)
} finally {
await waitAnyKey();
await driver?.quit();
}
}())

View File

@ -24,7 +24,6 @@ import waitAnyKey from './waitAnyKey';
} catch (e) { } catch (e) {
console.log(e) console.log(e)
} finally { } finally {
await new Promise(resolve => setTimeout(resolve, 5 * 1000));
await waitAnyKey(); await waitAnyKey();
await driver?.quit(); await driver?.quit();
} }