MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / WalkArray

Method WalkArray

cpp/iedriver/Script.cpp:731–764  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

729}
730
731int Script::WalkArray(IElementManager* element_manager,
732 const Json::Value& array_value) {
733 LOG(TRACE) << "Entering Script::WalkArray";
734
735 int status_code = WD_SUCCESS;
736 Json::UInt array_size = array_value.size();
737 std::wstring array_script = L"(function(){ return function() { return [";
738 for (Json::UInt index = 0; index < array_size; ++index) {
739 if (index != 0) {
740 array_script += L",";
741 }
742 std::wstring index_string = std::to_wstring(static_cast<long long>(index));
743 array_script += L"arguments[" + index_string + L"]";
744 }
745 array_script += L"];}})();";
746
747 Script array_script_wrapper(this->script_engine_host_, array_script, array_size);
748 for (Json::UInt index = 0; index < array_size; ++index) {
749 status_code = array_script_wrapper.AddArgument(element_manager, array_value[index]);
750 if (status_code != WD_SUCCESS) {
751 break;
752 }
753 }
754
755 if (status_code == WD_SUCCESS) {
756 status_code = array_script_wrapper.Execute();
757 }
758
759 if (status_code == WD_SUCCESS) {
760 this->AddArgument(array_script_wrapper.result());
761 }
762
763 return status_code;
764}
765
766int Script::WalkObject(IElementManager* element_manager,
767 const Json::Value& object_value) {

Callers 1

AddArgumentMethod · 0.95

Calls 5

AddArgumentMethod · 0.95
LOGClass · 0.50
sizeMethod · 0.45
ExecuteMethod · 0.45
resultMethod · 0.45

Tested by

no test coverage detected