Noi-ask Extensions: Update ChatGPT submit btn selector

`data-testid` does not exist on paid version. This fix works on both paid and unpaid version of ChatGPT.
It relies on the dom structure:
"main > last form > last button" should be the submit button
This commit is contained in:
king 2024-05-19 13:06:24 +10:00
parent 9787604e25
commit c04e0e5a7b

View File

@ -48,7 +48,10 @@ class OpenAIAsk extends NoiAsk {
static url = 'https://chatgpt.com';
static submit() {
const btn = document.querySelector('button[data-testid="send-button"]');
const forms = document.querySelectorAll('main form');
const form = forms[forms.length - 1];
const buttons = form.querySelectorAll('button');
const btn = buttons[buttons.length - 1];
if (btn) this.autoClick(btn);
}
}