ademsandeep Posted December 4, 2013 Posted December 4, 2013 (edited) Hi All, All my tests are written in selenium. There is a functionality related to file upload for which i am using Auto it to upload the file. Here is the code which will enter file path in the dialog. Browser i am using is IE9. Language C# System.Threading.Thread.Sleep(2000); //enter file path if (autoIt.ControlSend("", windowName, textBoxLocator, """+filePath+""") == 0) throw new Exception("Control dosent exists or control is not enabled"); //click button if (autoIt.ControlClick("", windowName, buttonLocator) == 0) throw new Exception("Control dosent exists or control is not enabled"); It actually entering file path but it's considering some of portion as special characters. For example the path i was is C:SCA2.6SCA2_6ProjectsSage.CRE.Cloud.UIAutomation.Package2InputFilesFilesToUpload audit (1).csv Autually It was entering . C:SCA2.^|SCA2_6ProjectsSage.CRE>Cloud.UIAutomation.package2InputFilesFilesToupload audit (1).csv Can any one help me on this.Is there any escape sequence to skip this special charcters. Regards, Sandeep Edited December 4, 2013 by ademsandeep
l3ill Posted December 4, 2013 Posted December 4, 2013 Hi ademsandeep, And welcome to the forum! If it is always going to be the exact same path you could tie it to a variable and insert that instead: if (autoIt.ControlSend("", windowName, textBoxLocator, "\""+filePath+"\"") == 0) $filePath = "C:\SCA2.^|SCA2_6\Projects\Sage.CRE>Cloud.UIAutomation.package2\InputFiles\FilesToupload\ audit (1).csv" if (autoIt.ControlSend("", windowName, textBoxLocator, $filePath) == 0) otherwise you might need StringRegExpReplace . Bill My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now