Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get QML Window properties #54

Open
Jiloc opened this issue Jul 31, 2017 · 1 comment
Open

How to get QML Window properties #54

Jiloc opened this issue Jul 31, 2017 · 1 comment

Comments

@Jiloc
Copy link

Jiloc commented Jul 31, 2017

When the Window (and/or ApplicationWindow) component is instantiated it is replaced by a RootItem.

You can check this by calling selenium's webdriver.page_source (in Python).

At the same time all properties I defined in the component seem to disappear.

A Little example:

import QtQuick 2.8
import QtQuick.Window 2.2

Window {
    visible: true
    width: 640
    height: 480
    property alias innerText: textEdit.text
    property string testString: "test"

    TextEdit {
        id: textEdit
        text: qsTr("Enter some text...")
        verticalAlignment: Text.AlignVCenter
        anchors.top: parent.top
        anchors.horizontalCenter: parent.horizontalCenter
        anchors.topMargin: 20
        Rectangle {
            anchors.fill: parent
            anchors.margins: -10
            color: "transparent"
            border.width: 1
        }
    }
}

If i call webdriver.page_source I get

<?xml version="1.0" encoding="UTF-8"?>
<RootItem elementId="86a3c2d01650fca2c9dc2363884ebfd2">
    <TextEdit elementId="223ee63e06bccf63aede46e315c86ac2">
        <Rectangle elementId="fe6f1d7dfd8608cf1bd9b6c167e73416"/>
    </TextEdit>
</RootItem>

If i try to get innerText or testString properties with webdriver.find_element_by_tag_name("RootItem").get_attribute("testString") it returns None and the server logs a warning:

[13145972118.403][WARNING]: property not found.

@Jiloc
Copy link
Author

Jiloc commented Aug 30, 2017

Was it unclear or you don't know how to solve it? If it's the former I'd be happy to clarify what I meant!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant