coffeeinabit 0.0.22 → 0.0.23
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/tools/human_mouse.js +7 -0
- package/tools/send_messages.js +1 -0
package/package.json
CHANGED
package/tools/human_mouse.js
CHANGED
|
@@ -98,6 +98,7 @@ export const humanLikeMouseMove = async (page, targetX, targetY, options = {}) =
|
|
|
98
98
|
|
|
99
99
|
export const humanLikeClick = async (page, locator, options = {}) => {
|
|
100
100
|
if (!page || !locator) {
|
|
101
|
+
console.error('[humanLikeClick] Missing page or locator');
|
|
101
102
|
return false;
|
|
102
103
|
}
|
|
103
104
|
|
|
@@ -114,12 +115,15 @@ export const humanLikeClick = async (page, locator, options = {}) => {
|
|
|
114
115
|
if (!handle) {
|
|
115
116
|
if (fallbackOptions) {
|
|
116
117
|
await locator.click({ timeout, ...fallbackOptions });
|
|
118
|
+
console.warn('[humanLikeClick] Locator handle not found, used fallback click');
|
|
117
119
|
return true;
|
|
118
120
|
}
|
|
121
|
+
console.error('[humanLikeClick] Locator handle not found, click failed');
|
|
119
122
|
return false;
|
|
120
123
|
}
|
|
121
124
|
|
|
122
125
|
let box = await handle.boundingBox();
|
|
126
|
+
console.log('[humanLikeClick] Element bounding box:', box);
|
|
123
127
|
if (!box) {
|
|
124
128
|
await page.waitForTimeout(50);
|
|
125
129
|
box = await handle.boundingBox();
|
|
@@ -128,12 +132,15 @@ export const humanLikeClick = async (page, locator, options = {}) => {
|
|
|
128
132
|
if (!box) {
|
|
129
133
|
if (fallbackOptions) {
|
|
130
134
|
await locator.click({ timeout, ...fallbackOptions });
|
|
135
|
+
console.warn('[humanLikeClick] Bounding box not found, used fallback click');
|
|
131
136
|
return true;
|
|
132
137
|
}
|
|
133
138
|
await locator.click({ timeout });
|
|
139
|
+
console.warn('[humanLikeClick] Bounding box not found, used direct click');
|
|
134
140
|
return true;
|
|
135
141
|
}
|
|
136
142
|
|
|
143
|
+
console.log('[humanLikeClick] Moving mouse to element and clicking');
|
|
137
144
|
const paddingX = Math.min(box.width * 0.3, 12);
|
|
138
145
|
const paddingY = Math.min(box.height * 0.3, 12);
|
|
139
146
|
|
package/tools/send_messages.js
CHANGED
|
@@ -144,6 +144,7 @@ export async function executeSendMessages(page, action) {
|
|
|
144
144
|
await waitRandom(260, 420, page);
|
|
145
145
|
await humanLikeClick(page, btn, { timeout: 5000 });
|
|
146
146
|
await waitRandom(650, 950, page);
|
|
147
|
+
console.log('[send_messages] Clicked Message button, checking if conversation opened');
|
|
147
148
|
if (await checkConversationOpened()) return true;
|
|
148
149
|
}
|
|
149
150
|
} catch (e) {
|