diff --git a/bun.lockb b/bun.lockb index 0db33f0..9779e64 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/gpt.ts b/gpt.ts index 0da9ac7..4d849d3 100644 --- a/gpt.ts +++ b/gpt.ts @@ -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(); } }()) \ No newline at end of file diff --git a/package.json b/package.json index 841acd8..b22aa4a 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "author": "", "license": "ISC", "dependencies": { + "@faker-js/faker": "^8.3.1", "mocha": "^10.2.0", "selenium-webdriver": "^4.16.0" }, diff --git a/waitAnyKey.ts b/waitAnyKey.ts index ac7738b..ffbb2dc 100644 --- a/waitAnyKey.ts +++ b/waitAnyKey.ts @@ -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();