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

Method SetFileValue

cpp/iedriver/CommandHandlers/SendKeysCommandHandler.cpp:835–862  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

833 return TRUE;
834}
835unsigned int WINAPI SendKeysCommandHandler::SetFileValue(void *file_data) {
836 FileNameData* data = reinterpret_cast<FileNameData*>(file_data);
837 ::Sleep(100);
838
839 bool file_name_successfully_sent = false;
840 unsigned int return_value = 0;
841 // On a separate thread, so must reinitialize COM.
842 HRESULT hr = ::CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
843 if (FAILED(hr)) {
844 return_value = 1;
845 LOGHR(WARN, hr) << "COM library initialization encountered an error";
846 error_text = L"The driver could not initialize COM on the thread used to handle the file selection dialog.";
847 } else {
848 file_name_successfully_sent = SendFileNameKeys(data);
849 ::CoUninitialize();
850 if (!file_name_successfully_sent) {
851 return_value = 1;
852 }
853 }
854
855 // TODO: Remove this and the supporting functions once feedback
856 // on the use of UI Automation is completed.
857 if (!file_name_successfully_sent && data->useLegacyDialogHandling) {
858 LegacySelectFile(data);
859 }
860
861 return return_value;
862}
863
864bool SendKeysCommandHandler::LegacySelectFile(FileNameData* data) {
865 HWND ie_main_window_handle = data->main;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected