QQmlApplicationEngine support:
QQmlApplicationEngine can also be used with QtWebDriver.
e.g: https://github.com/cisco-open-source/qtdeclarative/pull/1
Javascript expressions can locate QML elements by objectName: https://github.com/cisco-open-source/qtwebdriver/issues/6
Use ObjectNameUtils.findChild() in Javascript expressions to access qml elements by objectName.
ObjectNameUtils.findChild()
e.g: With this qml
Rectangle { id: rect objectName: "rect" Text { id: button objectName: "button" text: "Home" } }
This test will work:
bText = webdriver.execute_script("var v = ObjectNameUtils.findChild('button'); return v.text;") assert 'Home' in bText
There was an error while loading. Please reload this page.