update xpath

This commit is contained in:
Admin 2025-09-08 07:36:42 +07:00
parent d20ac8d6ce
commit b6d6a6dd79
3 changed files with 10 additions and 18 deletions

File diff suppressed because one or more lines are too long

View File

@ -266,26 +266,18 @@ export class ContentService {
element.dispatchEvent(event); element.dispatchEvent(event);
} }
private _clickIfExists(xpath: string): Promise<boolean> { private _clickIfExists(selector: string): Promise<boolean> {
return new Promise((resolve) => { return new Promise((resolve) => {
const result = document.evaluate( const element = document.querySelector(selector);
xpath,
document,
null,
XPathResult.FIRST_ORDERED_NODE_TYPE,
null
);
const element = result.singleNodeValue as HTMLElement | null;
if (element) { if (element) {
element.scrollIntoView({ behavior: "auto", block: "center" }); element.scrollIntoView({ behavior: "auto", block: "center" });
setTimeout(() => { setTimeout(() => {
element.click(); (element as any)?.click();
resolve(true); resolve(true);
}, 100); // Đợi scroll một chút rồi click }, 100); // Đợi scroll một chút rồi click
} else { } else {
console.warn("Không tìm thấy phần tử:", xpath); console.warn("Không tìm thấy phần tử:", selector);
resolve(false); resolve(false);
} }
}); });

View File

@ -17,7 +17,7 @@ export class TeamsChatService {
root_id: '[aria-selected="true"] [id^="chat-list-item"]', root_id: '[aria-selected="true"] [id^="chat-list-item"]',
room_name: '[data-tid="chat-title"]', room_name: '[data-tid="chat-title"]',
close_reply_btn: close_reply_btn:
"/html/body/div[1]/div/div/div/div[6]/div[4]/div/div[1]/div/div[3]/div/div[3]/div/div[2]/div/div[2]/div/div/card/div/div/div[2]/div/div[1]/button", '[data-track-action-scenario="messageQuotedReplyDismissed"]',
reply_btn: '[aria-label="Reply"]', reply_btn: '[aria-label="Reply"]',
chat_input: chat_input:
// "/html/body/div[1]/div/div/div/div[6]/div[4]/div/div[1]/div/div[3]/div/div[3]/div/div[2]/div/div[2]/div[1]/div", // "/html/body/div[1]/div/div/div/div[6]/div[4]/div/div[1]/div/div[3]/div/div[3]/div/div[2]/div/div[2]/div[1]/div",