@ubaidbinwaris/linkedin 1.0.9 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/login/login.js +10 -4
- package/src/utils/logger.js +1 -0
package/package.json
CHANGED
package/src/login/login.js
CHANGED
|
@@ -160,10 +160,16 @@ async function loginToLinkedIn(options = {}, credentials = null) {
|
|
|
160
160
|
try {
|
|
161
161
|
logger.info("Attempting to resolve simple checkpoint headlessly...");
|
|
162
162
|
const simpleResolved = await page.evaluate(async () => {
|
|
163
|
-
|
|
164
|
-
const
|
|
165
|
-
|
|
166
|
-
|
|
163
|
+
// Find buttons, links, or elements with button role
|
|
164
|
+
const candidates = Array.from(document.querySelectorAll('button, a, [role="button"], input[type="submit"], input[type="button"]'));
|
|
165
|
+
const targetText = ['Yes', 'Skip', 'Not now', 'Continue', 'Sign in', 'Verify', 'Let’s do it', 'Next'];
|
|
166
|
+
|
|
167
|
+
// Find a candidate with one of these texts
|
|
168
|
+
const btn = candidates.find(b => {
|
|
169
|
+
const text = (b.innerText || b.value || '').trim();
|
|
170
|
+
return targetText.some(t => text.includes(t));
|
|
171
|
+
});
|
|
172
|
+
|
|
167
173
|
if (btn) {
|
|
168
174
|
btn.click();
|
|
169
175
|
return true;
|
package/src/utils/logger.js
CHANGED
|
@@ -21,6 +21,7 @@ const defaultLogger = winston.createLogger({
|
|
|
21
21
|
transports: [
|
|
22
22
|
new winston.transports.File({ filename: path.join(logDir, "error.log"), level: "error" }),
|
|
23
23
|
new winston.transports.File({ filename: path.join(logDir, "combined.log") }),
|
|
24
|
+
new winston.transports.Console() // Output to console
|
|
24
25
|
],
|
|
25
26
|
});
|
|
26
27
|
|