This commit is contained in:
nobug
2023-12-10 23:32:32 +08:00
parent 5622856f33
commit 74b76ab60e
4 changed files with 29 additions and 3 deletions

BIN
bun.lockb

Binary file not shown.

27
gpt.ts
View File

@ -1,5 +1,7 @@
import { Builder, By, Capabilities, WebDriver } from 'selenium-webdriver';
import waitAnyKey from './waitAnyKey';
import { faker } from '@faker-js/faker';
(async function secondTest() {
let driver: WebDriver | null = null;
@ -17,10 +19,33 @@ import waitAnyKey from './waitAnyKey';
.withCapabilities(capabilities)
.build();
driver.get("https://chat.oaifree.com/auth/signup")
const emailSuffix = "@yhfrp.tk"
const username = faker.internet.userName()
const password = faker.internet.password()
const email = username + emailSuffix
console.debug(`username :>> `, username);
console.debug(`password :>> `, password);
console.debug(`email :>> `, email);
await waitAnyKey('Press any key to continue...');
await driver.findElement(By.id("username")).sendKeys(email)
await driver.findElement(By.id("password")).sendKeys(password)
await driver.findElement(By.name("action")).click()
await driver.findElement(By.id("submit-token")).click()
// NoSuchElementError: Unable to locate element: *[id="submit-token"]
await waitAnyKey('输入 verify 地址后继续...')
// self.driver.find_element(By.ID, "swal2-input").send_keys("https://mandrillapp.com/track/click/31165340/auth0.openai.com?p=eyJzIjoiR3BzV1BpQkMxdzA0ZHFGcGdCMjdZdUkxdk1rIiwidiI6MSwicCI6IntcInVcIjozMTE2NTM0MCxcInZcIjoxLFwidXJsXCI6XCJodHRwczpcXFwvXFxcL2F1dGgwLm9wZW5haS5jb21cXFwvdVxcXC9lbWFpbC12ZXJpZmljYXRpb24_dGlja2V0PUMzWmY0SFFSSnZRdGhSSmJocmRZM0VGdUhwOVkwUmYxI1wiLFwiaWRcIjpcImMxZDlmYjJiOTVhMzRlMGY5YTU4YjlhZWNiNDEzYmU4XCIsXCJ1cmxfaWRzXCI6W1wiMWM3OTUyMjNiMmQ0YmUwMjBmZDJhNTBmMmM5YzQxZjEwMThlNDU0Y1wiXX0ifQ")
await driver.findElement(By.css(".swal2-confirm")).click()
await driver.findElement(By.id("username")).sendKeys(username)
await driver.findElement(By.name("action")).click()
} catch (e) {
console.log(e)
} finally {
await waitAnyKey();
await waitAnyKey('Press any key to exit...');
await driver?.quit();
}
}())

View File

@ -10,6 +10,7 @@
"author": "",
"license": "ISC",
"dependencies": {
"@faker-js/faker": "^8.3.1",
"mocha": "^10.2.0",
"selenium-webdriver": "^4.16.0"
},

View File

@ -1,5 +1,5 @@
export default function waitAnyKey() {
console.log('Press any key to continue...');
export default function waitAnyKey(message: string) {
console.log(message);
return new Promise(resolve => {
process.stdin.setRawMode(true);
process.stdin.resume();