Loosen selectors for login fields in automated profile creation (#638)

Fixes #637 

- Username will match if name attribute is one of: user, username, email
- Password will match if type is password and name attribute is one of:
pass, password

This loosens the rules sufficiently to solve the issue with the URL in
the linked issue without requiring users to pass custom CSS selectors at
this point.

It looks like we were also using XPath methods like contains whereas
puppeteer expects CSS selectors, hence the syntax change.
This commit is contained in:
Tessa Walsh 2024-07-11 18:55:06 -04:00 committed by GitHub
parent 151115d46c
commit fd98033268
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View file

@ -266,10 +266,10 @@ async function automatedProfile(
try {
u = await page.waitForSelector(
"//input[contains(@name, 'user') or contains(@name, 'email')]",
"input[name='user'],input[name='username'],input[name='email']",
);
p = await page.waitForSelector(
"//input[contains(@name, 'pass') and @type='password']",
"input[type='password'].input[name='pass'],input[name='password']",
);
} catch (e) {
if (params.debugScreenshot) {