Improve "Показать" button scrolling in GetCardInfoScript to handle devices with short screen heights:
- Add logic to scroll WebView until the button is in the visible top-third of the screen. - Account for bottom navigation obstruction and ensure reliable tapping.
This commit is contained in:
parent
44e60fc09f
commit
052f9051e1
@ -251,6 +251,36 @@ void GetCardInfoScript::doStart() {
|
||||
|
||||
AdbUtils::makeTap(m_deviceId, cardBtn.x(), cardBtn.y());
|
||||
|
||||
// Скроллим WebView вверх, пока "Показать" не окажется в верхней трети экрана.
|
||||
// На устройствах с короткой высотой (например, SM-A165F, h=2340) кнопка "Показать"
|
||||
// находится за bottom navigation, и тап уходит в нав-бар.
|
||||
const int targetTopY = device.screenHeight / 3;
|
||||
for (int scrollAttempt = 0; scrollAttempt < 6; ++scrollAttempt) {
|
||||
QThread::msleep(scrollAttempt == 0 ? 2000 : 600);
|
||||
xmlScreenParser.parseAndSaveXml(AdbUtils::getScreenDumpAsXml(m_deviceId, ++m_counter));
|
||||
|
||||
Node candidate = xmlScreenParser.findButtonNode("Показать", false);
|
||||
if (candidate.isEmpty()) {
|
||||
if (xmlScreenParser.isHomeScreen()) {
|
||||
cardBtn = xmlScreenParser.findCardButtonByLastNumbers(card.lastNumbers);
|
||||
if (!cardBtn.isEmpty()) {
|
||||
qDebug() << "[GetCardInfo] Still on home before scroll, re-tapping card" << card.lastNumbers;
|
||||
AdbUtils::makeTap(m_deviceId, cardBtn.x(), cardBtn.y());
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (candidate.y() <= targetTopY) {
|
||||
qDebug() << "[GetCardInfo] 'Показать' already at top y=" << candidate.y();
|
||||
break;
|
||||
}
|
||||
const int swipeFromY = candidate.y();
|
||||
const int swipeToY = device.screenHeight / 6;
|
||||
qDebug() << "[GetCardInfo] Scrolling 'Показать' up:" << swipeFromY << "->" << swipeToY;
|
||||
AdbUtils::makeSwipe(m_deviceId, device.screenWidth / 2, swipeFromY,
|
||||
device.screenWidth / 2, swipeToY);
|
||||
}
|
||||
|
||||
// Ждём экран карты и стабильной геометрии блока реквизитов.
|
||||
// Без этого тап по "Показать" во время reflow уезжает ниже — в "Защиту от мошенников".
|
||||
// Стабильность: "Показать" совпадает по y1 с "Реквизиты карты" И координаты не меняются в двух подряд дампах.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user