ddd
This commit is contained in:
27
gpt.ts
27
gpt.ts
@ -1,5 +1,7 @@
|
|||||||
import { Builder, By, Capabilities, WebDriver } from 'selenium-webdriver';
|
import { Builder, By, Capabilities, WebDriver } from 'selenium-webdriver';
|
||||||
import waitAnyKey from './waitAnyKey';
|
import waitAnyKey from './waitAnyKey';
|
||||||
|
import { faker } from '@faker-js/faker';
|
||||||
|
|
||||||
|
|
||||||
(async function secondTest() {
|
(async function secondTest() {
|
||||||
let driver: WebDriver | null = null;
|
let driver: WebDriver | null = null;
|
||||||
@ -17,10 +19,33 @@ import waitAnyKey from './waitAnyKey';
|
|||||||
.withCapabilities(capabilities)
|
.withCapabilities(capabilities)
|
||||||
.build();
|
.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) {
|
} catch (e) {
|
||||||
console.log(e)
|
console.log(e)
|
||||||
} finally {
|
} finally {
|
||||||
await waitAnyKey();
|
await waitAnyKey('Press any key to exit...');
|
||||||
await driver?.quit();
|
await driver?.quit();
|
||||||
}
|
}
|
||||||
}())
|
}())
|
@ -10,6 +10,7 @@
|
|||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@faker-js/faker": "^8.3.1",
|
||||||
"mocha": "^10.2.0",
|
"mocha": "^10.2.0",
|
||||||
"selenium-webdriver": "^4.16.0"
|
"selenium-webdriver": "^4.16.0"
|
||||||
},
|
},
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
export default function waitAnyKey() {
|
export default function waitAnyKey(message: string) {
|
||||||
console.log('Press any key to continue...');
|
console.log(message);
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
process.stdin.setRawMode(true);
|
process.stdin.setRawMode(true);
|
||||||
process.stdin.resume();
|
process.stdin.resume();
|
||||||
|
Reference in New Issue
Block a user