Implemented `GetCardInfoScript`, `GetProfileInfoScript`, and `GetLastTransactionsScript` to automate data extraction workflows for Ozon platform. Includes support for XML parsing, ad banner handling, card navigation, profile parsing, and transaction retrieval. Added related asset files.
85 lines
2.1 KiB
C++
85 lines
2.1 KiB
C++
#pragma once
|
|
|
|
#include <QObject>
|
|
#include <QDomElement>
|
|
#include "android/xml/Node.h"
|
|
#include "db/AccountInfo.h"
|
|
#include "db/TransactionInfo.h"
|
|
|
|
namespace Ozon {
|
|
|
|
class ScreenXmlParser final : public QObject {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit ScreenXmlParser(QObject *parent = nullptr);
|
|
|
|
~ScreenXmlParser() override;
|
|
|
|
Node tryToFindBannerOrDialog(int width, int height);
|
|
|
|
Node tryToFindSecurityBanner();
|
|
|
|
Node tryToFindSelectBottomSheet();
|
|
|
|
Node findTextNode(const QString &text);
|
|
|
|
Node findTextNode(const QString &text, int x1, int y1, int x2, int y2);
|
|
|
|
Node findFirstEditText();
|
|
|
|
Node findButtonNode(const QString &text, bool contains);
|
|
|
|
Node findNodeByContentDesc(const QString &contentDesc);
|
|
|
|
bool isHomeScreen();
|
|
|
|
Node tryToFindAdBanner();
|
|
|
|
// Returns a Button node whose text is exactly 4 digits (card last numbers)
|
|
Node findCardButtonOnHomeScreen();
|
|
|
|
// Finds a card button whose text ends with the given last 4 digits
|
|
Node findCardButtonByLastNumbers(const QString &lastNumbers);
|
|
|
|
// Returns all cards visible on the home screen as AccountInfo stubs
|
|
// (lastNumbers, description, amount filled; id=-1, cardNumber empty)
|
|
QList<AccountInfo> parseCardsOnHomeScreen();
|
|
|
|
bool isProfileScreen();
|
|
|
|
Node findUserNameOnHomeScreen(int screenHeight);
|
|
|
|
QString parseProfileFullName();
|
|
|
|
QString parseProfilePhone();
|
|
|
|
QList<Node> tryToFindPinCode(const QString &pinCode, const QString &title);
|
|
|
|
QList<Node> getLast2DaysTransactions();
|
|
|
|
void parseAndSaveXml(const QString &xml);
|
|
|
|
TransactionInfo parseTransactionInfoHistory(int screenWidth, int screenHeight);
|
|
TransactionInfo parseTransactionInfo(int screenWidth, int screenHeight);
|
|
|
|
QList<TransactionInfo> parseTodayAndYesterdayReportHistory();
|
|
|
|
QList<TransactionInfo> parseTodayAndYesterdayHistory();
|
|
|
|
|
|
QList<QPair<AccountInfo, Node> > parseAccountsInfo();
|
|
|
|
// Finds a TextView with full card number (format "XXXX XXXX XXXX XXXX")
|
|
QString findFullCardNumber();
|
|
|
|
void test();
|
|
|
|
private:
|
|
QList<Node> m_nodes;
|
|
QDomElement m_xml;
|
|
|
|
QList<Node> findPinCodeNodes(const QString &pinCode);
|
|
};
|
|
|
|
} // namespace Ozon
|