PiotrK Posted October 5, 2011 Share Posted October 5, 2011 Hi all, I'm looking for solution my problem to upload the file by using Selenium and auto it script. I would like to test, upload one file from my PC to my www page. I'veread that I can use AutoIT tool with Selenium to that. But I don'tknow how can I use this AutoIt to create script and use it. Can someone help me with this. please? I'm newbie with AutoIt. For simple example: 1. I'm open http://tinypic.com/2. Press button to upload the image (Browse)3. Search image file from PC and upload the image4. Press "Upload now" button on the page Ad.1I have simple selenium code to open the page: namespace SeleniumProject.Blog{ class AutoIt { private ISelenium selenium; //public StringBuilder verificationerrors; [setUp] public void SetupTest() { selenium = new DefaultSelenium("localhost", 4444, "*firefox", "http://tinypic.com/"); selenium.Start(); selenium.WindowMaximize(); } [Test] public void AutoITtest(string filePath) { selenium.Open("/"); var procStartInfo = new System.Diagnostics.ProcessStartInfo(@"C:\Selenium\AutoIt\autotest.exe", "c:\\selenium\\pass.txt"); var proc = new System.Diagnostics.Process { StartInfo = procStartInfo }; proc.Start(); } } Ad.2 and Ad.3 My AutoIt code looks like: autotest.au3 -> compile to autotest.exe WinActivate("Browse");Local $file = "c:\selenium\pass.png"ControlSetText("Choose file", "", "Edit1", $file )ControlClick("Choose file", "", "Open") I know that isn't workin but I don't know how to change this to do this 4 steps. Please help me! Thanks a lot!!Piotr Link to comment Share on other sites More sharing options...
PiotrK Posted October 5, 2011 Author Share Posted October 5, 2011 Ok, my selenium code is run: class AutoIt { private ISelenium selenium; //public StringBuilder verificationErrors; [SetUp] public void SetupTest() { selenium = new DefaultSelenium("localhost", 4444, "*firefox", "http://tinypic.com/"); selenium.Start(); selenium.WindowMaximize(); } [Test] public void AutoITtest() { selenium.Open("/"); System.Diagnostics.Process.Start("C:\\Selenium\\AutoIt\autotest.exe"); } } } But I don't know how to prepare Autoit script to upload image to the page http://tinypic.com. Please help me. I have something like this, but it doesn't work: WinActivate("Browse"); Local $file = "c:\selenium\pass.txt" ControlSetText("Choose file", "", "Edit1", $file ) ControlClick("Choose file", "", "Open") I have following problem: System.ComponentModel.Win32Exception : The system cannot find the file specified ManjuKb00232 1 Link to comment Share on other sites More sharing options...
ManjuKb00232 Posted April 28, 2014 Share Posted April 28, 2014 hello im facing same issue can any one help replying to this thread ? Link to comment Share on other sites More sharing options...
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