Skip to content

Commit 1510544

Browse files
Andrii BoichukAndrii Boichuk
authored andcommitted
Fix RemotePlayerGetState for quick2
1 parent ad7fdf9 commit 1510544

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/webdriver/extension_qt/quick2_view_executor.cc

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -826,11 +826,23 @@ void Quick2ViewCmdExecutor::GetPlayerState(const ElementId &element, PlayerState
826826
if (NULL == pItem)
827827
return;
828828

829-
830829
base::Value* playbackState = NULL;
831-
GetAttribute(element, "playbackState", &playbackState, error);
830+
QVariant propertyValue = pItem->property("playbackState");
832831

833-
if( error != NULL && *error != NULL && (*error)->code() != kSuccess){
832+
if (propertyValue.isValid()) {
833+
// convert QVariant to base::Value
834+
switch (propertyValue.type()) {
835+
case QVariant::Int:
836+
playbackState = Value::CreateIntegerValue(propertyValue.toInt());
837+
break;
838+
default:
839+
session_->logger().Log(kWarningLogLevel, "wrong property type");
840+
*error = new Error(kInvalidElementState);
841+
return;
842+
}
843+
} else {
844+
session_->logger().Log(kWarningLogLevel, "property not found.");
845+
*error = new Error(kInvalidElementState);
834846
return;
835847
}
836848

0 commit comments

Comments
 (0)