update xpath
This commit is contained in:
parent
d20ac8d6ce
commit
b6d6a6dd79
File diff suppressed because one or more lines are too long
|
|
@ -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);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -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",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue