If you want to save to another folder, select Browse, and select the folder you want. Select Enter file name here and type a name. Select File > Save a Copy > OneDrive - Personal.
![]() It does not return any value.First line of SendKeys.SendWait() takes a string as argument that it writes the file name text box of file upload window.Second line of SendKeys.SendWait() takes a string like “” that it executes the enter key from keyboard.Note that we need to add System.Windows.Forms namespace to get this method.Lets do a short project on how we can implement in our test scenario. It sends the given key on the active application and waits for the message to be processed. It has a SendKeys class that has a method SendWait(string keys). We have to add System.Threading namespace to implement this statement.Note that we need to add the following namespace SendKeys.SendWait().We will not get this namespace if we do not add “ System.Windows.Forms” reference from Reference manager window. To prevent this message we use this statement. We see system sometimes try to type quickly on file name box and do missing some part from beginning and at the time if enter key pressed System throws a invalid file path error message. How to add a reference from Nuget package can be found in my another post.Step 3 : Write the following code for opening page using Firefox Browser under static void Main(string args) method.Note that we need to add following namespaces for webdriver.Step 4 : Write the code for clicking on Browse button of the page to open file upload dialog.Step 5 : Write the code to handle file upload dialog to browse image and click open button.Note : Sometimes we need to add Thread.Sleep(30) method between these two SendKeys.SendWait() method to stop to press enter key until File name typing is complete. Samsung m2070 easy printer manager for macIn our future post we will show on how we can upload file using Java.Till then ….Happy scripting with Selenium Webdriver using the power of C#. It opens the browser and upload the image file using SendKeys.SendWait() methods.That’s all for now. Main method will be,Step 8 : Run the application by clicking on Start button.
0 Comments
Leave a Reply. |
AuthorJames ArchivesCategories |