Commit 0c57c404 authored by nanahira's avatar nanahira

changes

parent 8a82498b
Pipeline #23681 canceled with stages
...@@ -120,7 +120,9 @@ export async function getOpenAIAuth({ ...@@ -120,7 +120,9 @@ export async function getOpenAIAuth({
// login as well (optional) // login as well (optional)
if (email && password) { if (email && password) {
await waitForConditionOrAtCapacity(page, () => await waitForConditionOrAtCapacity(page, () =>
page.waitForSelector('#__next .btn-primary', { timeout: timeoutMs }) page.waitForSelector('#__next button:first-child', {
timeout: timeoutMs
})
) )
await delay(500) await delay(500)
...@@ -131,7 +133,7 @@ export async function getOpenAIAuth({ ...@@ -131,7 +133,7 @@ export async function getOpenAIAuth({
waitUntil: 'networkidle2', waitUntil: 'networkidle2',
timeout: timeoutMs timeout: timeoutMs
}), }),
page.click('#__next .btn-primary') page.click('#__next button:first-child')
]) ])
await delay(500) await delay(500)
} while (page.url().endsWith('/auth/login')) } while (page.url().endsWith('/auth/login'))
...@@ -153,7 +155,7 @@ export async function getOpenAIAuth({ ...@@ -153,7 +155,7 @@ export async function getOpenAIAuth({
]) ])
await page.waitForSelector('input[type="password"]', { visible: true }) await page.waitForSelector('input[type="password"]', { visible: true })
await page.type('input[type="password"]', password) await page.type('input[type="password"]', password)
await delay(50) await delay(200)
submitP = () => page.keyboard.press('Enter') submitP = () => page.keyboard.press('Enter')
} else if (isMicrosoftLogin) { } else if (isMicrosoftLogin) {
await page.click('button[data-provider="windowslive"]') await page.click('button[data-provider="windowslive"]')
...@@ -166,7 +168,7 @@ export async function getOpenAIAuth({ ...@@ -166,7 +168,7 @@ export async function getOpenAIAuth({
await delay(1500) await delay(1500)
await page.waitForSelector('input[type="password"]', { visible: true }) await page.waitForSelector('input[type="password"]', { visible: true })
await page.type('input[type="password"]', password) await page.type('input[type="password"]', password)
await delay(50) await delay(200)
submitP = () => page.keyboard.press('Enter') submitP = () => page.keyboard.press('Enter')
await Promise.all([ await Promise.all([
page.waitForNavigation(), page.waitForNavigation(),
...@@ -204,16 +206,22 @@ export async function getOpenAIAuth({ ...@@ -204,16 +206,22 @@ export async function getOpenAIAuth({
await delay(2000) await delay(2000)
const frame = page.mainFrame() const frame = page.mainFrame()
const submit = await page.waitForSelector('button[type="submit"]', { const submit = await page.waitForSelector(
timeout: timeoutMs 'button[type="submit"][data-action-button-primary="true"]',
}) {
await frame.focus('button[type="submit"]') timeout: timeoutMs
}
)
await frame.focus(
'button[type="submit"][data-action-button-primary="true"]'
)
await submit.focus() await submit.focus()
await submit.click() await submit.click()
await page.waitForSelector('#password', { timeout: timeoutMs }) await page.waitForSelector('#password', { timeout: timeoutMs })
await page.type('#password', password) await page.type('#password', password)
await delay(200) await delay(200)
submitP = () => page.click('button[type="submit"]') submitP = () =>
page.click('button[type="submit"][data-action-button-primary="true"]')
} }
await Promise.all([ await Promise.all([
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment