Fix some of the selectors used on the login form

This commit is contained in:
Conal Moloney 2023-08-01 19:24:48 +10:00
parent 05b389bd3f
commit 2bcb2e042d
Signed by: blaxpot
GPG Key ID: B0634F93252EBF15
2 changed files with 6 additions and 9 deletions

View File

@ -1705,7 +1705,7 @@ class MautrixController {
this.emailAppearObserver = new MutationObserver(changes => { this.emailAppearObserver = new MutationObserver(changes => {
for (const change of changes) { for (const change of changes) {
for (const node of change.addedNodes) { for (const node of change.addedNodes) {
const emailArea = node.querySelector("#login_email_area") const emailArea = node.querySelector("[class*='login_form_area']")
if (emailArea && !emailArea.classList.contains("MdNonDisp")) { if (emailArea && !emailArea.classList.contains("MdNonDisp")) {
window.__mautrixSendEmailCredentials() window.__mautrixSendEmailCredentials()
return return

View File

@ -210,7 +210,7 @@ export default class MessagesPuppeteer {
this.loginRunning = true this.loginRunning = true
await this.page.bringToFront() await this.page.bringToFront()
const loginContentArea = await this.page.waitForSelector("#login_content") const loginContentArea = await this.page.waitForSelector("[class*='page_login']")
switch (login_type) { switch (login_type) {
case "qr": { case "qr": {
@ -236,10 +236,7 @@ export default class MessagesPuppeteer {
return return
} }
const emailButton = await this.page.waitForSelector("#login_email_btn") await this.page.waitForSelector("[class*='login_form_area']", {visible: true})
await emailButton.click()
await this.page.waitForSelector("#login_email_area", {visible: true})
this.login_email = login_data["email"] this.login_email = login_data["email"]
this.login_password = login_data["password"] this.login_password = login_data["password"]
await this._sendEmailCredentials() await this._sendEmailCredentials()
@ -1263,9 +1260,9 @@ export default class MessagesPuppeteer {
async _sendEmailCredentials() { async _sendEmailCredentials() {
this.log("Inputting login credentials") this.log("Inputting login credentials")
await this._enterText(await this.page.$("#line_login_email"), this.login_email) await this._enterText(await this.page.$("input[name='email']"), this.login_email)
await this._enterText(await this.page.$("#line_login_pwd"), this.login_password) await this._enterText(await this.page.$("input[name='password']"), this.login_password)
await this.page.click("button#login_btn") await this.page.click("button[class*='button_login']")
} }
_receiveQRChange(url) { _receiveQRChange(url) {