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

Method WalkObject

cpp/iedriver/Script.cpp:766–801  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

764}
765
766int Script::WalkObject(IElementManager* element_manager,
767 const Json::Value& object_value) {
768 LOG(TRACE) << "Entering Script::WalkObject";
769
770 int status_code = WD_SUCCESS;
771 Json::Value::const_iterator it = object_value.begin();
772 int counter = 0;
773 std::string object_script = "(function(){ return function() { return {";
774 for (; it != object_value.end(); ++it) {
775 if (counter != 0) {
776 object_script += ",";
777 }
778 std::string counter_string = std::to_string(static_cast<long long>(counter));
779 std::string name = it.name();
780 object_script += "\"" + name + "\"" + ":arguments[" + counter_string + "]";
781 ++counter;
782 }
783 object_script += "};}})();";
784
785 Script object_script_wrapper(this->script_engine_host_, object_script, counter);
786 for (it = object_value.begin(); it != object_value.end(); ++it) {
787 status_code = object_script_wrapper.AddArgument(element_manager, object_value[it.name()]);
788 if (status_code != WD_SUCCESS) {
789 break;
790 }
791 }
792
793 if (status_code == WD_SUCCESS) {
794 status_code = object_script_wrapper.Execute();
795 }
796
797 if (status_code == WD_SUCCESS) {
798 this->AddArgument(object_script_wrapper.result());
799 }
800 return status_code;
801}
802
803} // namespace webdriver

Callers 1

AddArgumentMethod · 0.95

Calls 6

AddArgumentMethod · 0.95
endMethod · 0.80
nameMethod · 0.65
LOGClass · 0.50
ExecuteMethod · 0.45
resultMethod · 0.45

Tested by

no test coverage detected