Skip to content

Commit d1a0527

Browse files
committed
qml: getattribute(id)
1 parent a521488 commit d1a0527

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

src/webdriver/extension_qt/qml_view_executor.cc

+7
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,13 @@ void QQmlViewCmdExecutor::GetAttribute(const ElementId& element, const std::stri
439439
return;
440440

441441
QVariant propertyValue = pItem->property(key.c_str());
442+
443+
// substituate "id" with "objectName"
444+
QString idName("id");
445+
if (0 == idName.compare(key.c_str(), Qt::CaseInsensitive)) {
446+
propertyValue = pItem->property("objectName");
447+
}
448+
442449
Value* val = NULL;
443450

444451
if (propertyValue.isValid()) {

src/webdriver/extension_qt/qml_web_view_executor.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,7 @@ void QmlWebViewCmdExecutor::SetMute(const ElementId& element, bool mute, Error**
695695
void QmlWebViewCmdExecutor::GetMute(const ElementId& element, bool* mute, Error** error) {
696696
CHECK_VIEW_EXISTANCE
697697

698-
*error = webkitProxy_->GetMute(element, mute);
698+
*error = webkitProxy_->GetMute(element, mute);
699699
}
700700

701701
void QmlWebViewCmdExecutor::SetPlaybackSpeed(const ElementId &element, double speed, Error **error)

src/webdriver/extension_qt/quick2_view_executor.cc

+6
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,12 @@ void Quick2ViewCmdExecutor::GetAttribute(const ElementId& element, const std::st
451451

452452
QVariant propertyValue = pItem->property(key.c_str());
453453

454+
// substituate "id" with "objectName"
455+
QString idName("id");
456+
if (0 == idName.compare(key.c_str(), Qt::CaseInsensitive)) {
457+
propertyValue = pItem->property("objectName");
458+
}
459+
454460
Value* val = NULL;
455461

456462
if (propertyValue.isValid()) {

0 commit comments

Comments
 (0)