@ubox-tools/deploy-xperience 1.1.5 → 1.1.7
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/deploy.js +19 -15
- package/package.json +1 -1
package/deploy.js
CHANGED
|
@@ -816,21 +816,25 @@ async function installApp(page, appFullName) {
|
|
|
816
816
|
|
|
817
817
|
await searchFor(page, appFullName);
|
|
818
818
|
|
|
819
|
-
// Find the Install <a> element
|
|
820
|
-
//
|
|
821
|
-
//
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
819
|
+
// Find the Install <a> element inside the card that exactly matches the app name.
|
|
820
|
+
// Search may return multiple cards (e.g. "noXpace main" when searching "Xpace main"),
|
|
821
|
+
// so we must scope the Install button lookup to the exact-match card.
|
|
822
|
+
const installPos = await page.evaluate(name => {
|
|
823
|
+
for (const card of document.querySelectorAll('.card')) {
|
|
824
|
+
const title = card.querySelector('p.card-text');
|
|
825
|
+
if (!title || title.textContent.trim() !== name) continue;
|
|
826
|
+
const el = card.querySelector('a.uboxBot') ||
|
|
827
|
+
Array.from(card.querySelectorAll('a')).find(e => {
|
|
828
|
+
const r = e.getBoundingClientRect();
|
|
829
|
+
return r.width > 0 && r.height > 0 && e.textContent.trim().endsWith('Install');
|
|
830
|
+
});
|
|
831
|
+
if (!el) return null;
|
|
832
|
+
el.scrollIntoView({ block: 'center' });
|
|
833
|
+
const r = el.getBoundingClientRect();
|
|
834
|
+
return { x: Math.round(r.x + r.width / 2), y: Math.round(r.y + r.height / 2) };
|
|
835
|
+
}
|
|
836
|
+
return null;
|
|
837
|
+
}, appFullName);
|
|
834
838
|
|
|
835
839
|
if (!installPos) throw new Error(`Install button for "${appFullName}" not found`);
|
|
836
840
|
await page.mouse.click(installPos.x, installPos.y);
|
package/package.json
CHANGED