Commit 1de4e6fb authored by Travis Fischer's avatar Travis Fischer

fix: google login robustness

parent 0635fbcc
...@@ -137,7 +137,7 @@ export class ChatGPTAPIBrowser extends AChatGPTAPI { ...@@ -137,7 +137,7 @@ export class ChatGPTAPIBrowser extends AChatGPTAPI {
throw err throw err
} }
if (!this.isChatPage) { if (!this.isChatPage || this._isGoogleLogin) {
await this._page.goto(CHAT_PAGE_URL, { await this._page.goto(CHAT_PAGE_URL, {
waitUntil: 'networkidle2' waitUntil: 'networkidle2'
}) })
...@@ -147,11 +147,11 @@ export class ChatGPTAPIBrowser extends AChatGPTAPI { ...@@ -147,11 +147,11 @@ export class ChatGPTAPIBrowser extends AChatGPTAPI {
do { do {
const modalSelector = '[data-headlessui-state="open"]' const modalSelector = '[data-headlessui-state="open"]'
if (!(await this._page.$(modalSelector))) {
break
}
try { try {
if (!(await this._page.$(modalSelector))) {
break
}
await this._page.click(`${modalSelector} button:last-child`) await this._page.click(`${modalSelector} button:last-child`)
} catch (err) { } catch (err) {
// "next" button not found in welcome modal // "next" button not found in welcome modal
...@@ -517,8 +517,11 @@ export class ChatGPTAPIBrowser extends AChatGPTAPI { ...@@ -517,8 +517,11 @@ export class ChatGPTAPIBrowser extends AChatGPTAPI {
} }
protected async _getInputBox() { protected async _getInputBox() {
// [data-id="root"] try {
return this._page.$('textarea') return await this._page.$('textarea')
} catch (err) {
return null
}
} }
get isChatPage(): boolean { get isChatPage(): boolean {
......
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