I'm running a website testing automation tool(Sahi). But before starting the website testing, I'm forst checking whether the testing tool is 开发者_JS百科placed in drive C. So I'm writing a js to create a file system object:
function IsSahi_tool_Exists(DriveName)
{ var folderBool = false; var fso = new ActiveXObject("Scripting.FileSystemObject"); if(DriveName != null) { folderBool = fso.FolderExists(DriveName + ":\Sahi_tool"); if(folderBool == true) { folderBool = fso.FolderExists(DriveName + ":\Sahi_tool\sahi\bin"); } }
return folderBool;
}
But this function is returning false, and as I'm sure the path exist, I assume the error is because of ActiveXObject failing. Tried discussing in sahi form but no response. I have tried the following:
- Enabling all ActiveX controls in IE8->Internet Option->Security
- Indtalling Flash Player with ActiveX.
- Start->Run->regsvr32 "C:\Program Files\Common Files\Microsoft Shared\DAO\DAO360.DLL".
But still I'm the function is returning false. If I commented this function call, sahi is continuing to test the website but stops at another ActiveXObject function call. Please suggest me the procedure to enable ActiveX. No error is reported by the function ActiveXObject().
Thanks
Sahi runs Sahi script in the embedded rhino javascript engine. It does not have support for ActiveX in the rhino engine (You can access the ActiveX controls on the browser though)
Remember that Sahi scripts execute ONLY if Sahi is available and running. Your requirement is equivalent to writing a java program to check if java is installed.
Regards,
精彩评论