create gpt.ts
This commit is contained in:
26
gpt.ts
Normal file
26
gpt.ts
Normal 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();
|
||||||
|
}
|
||||||
|
}())
|
@ -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();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user