I tried "choose file" but it is not working. I am not sure what to set 2nd argument to. I tried changing the different paths of file folder; it then navigates to the correct location but it's not selecting the text file or image in that location.
Choose File xpath ${path}
So I want to use AutoIt but I don't know how to combine it with Selenium, how to write code and where to keep the AutoIt script.
Here you need to give two arguments
Web-element locator of the Browse button or link where you want to upload the file (locators like id, name xpath, css are user)
then give the complete file path of the file you want to upload for Ex: If you file is in desktop and name of the file is fileName.txt then you path will be C:\Users\your_username\Desktop\fileName.txt (you can also use relative path of the file)
one such example line of code would be
1. Choose File ${xpath_locator} C:\Users\your_username\Desktop\fileName.txt
2. Chose File ${xpath_locator} ${file_path_variable}
where the ${file_path_varibale} taken from variable table of robot file.
you can explore more on all the Selenium Keywords in Robot Framework Here.
It's better way to get Project Path and join it with your specific upload folder. After that just put the location with file name :)
The easiest way is to write C: then image file ex. C:\image.jpg
Choose file xpath C:\yourImageofYourFile.jpg
Related
Currently, I am working on an application that will need to always show the file extensions of the files inside the folder.
Example:
I have a folder named Awards and the Contents are Images.
Contents:
As you can see, the file extension is hidden.
But when you click the options red boxed on the image. the file extension will be shown.
My question is, Is there a way to check the checkbox on the Image using vb.net? If it is possible? How??
Thank you and Regards,
I want to edit the source code of an Impress file (.odp) but when I open it is just machine coded.
I want to do it because when I converted files from PowerPoint to an Impress File some parts got mixed up. Like for example footer and numbering can't be changed globally. So by editing the source code, I hope to be able to use find/replace in a Text Editor.
LibreOffice formats are zipped archives primarily containing XML files. So unzip the .odp and then edit content.xml.
When finished, zip it back up, making sure to zip it from the correct directory (the one that contains content.xml).
Documentation: https://help.libreoffice.org/Common/XML_File_Formats#XML_file_structure.
If you are using a Mac do the following:
Change the .odp extension to .zip by manually clicking the icon and renaming the file
Unzip the file using something other than the standard Archiver (I used Keka)
You will see the folder of contents including the content.xml which you can easily edit now
Crucial: Go into the directory with your separate files, select all the files then hit 'compress' from the options menu when you right click
Next, rename the .zip to .odp and the file will open successfully
I found that if you don't do option 4 above exactly then the file is slightly different and won't open due to a corruption message.
If you're given a full path to a file, say "blah/yadayada/file1.java", does IntelliJ offer any keyboard shortcut to open that file directly in the IDE?
IFAIK The closest you get cut and pasting the full path in IntelliJ and searching for a type (class/interface/enum) replacing / by . or searching for a resource file.
Using VS 2013 and vb.
I have a web page and on a button click i would like file explorer to open so the user can navigate to a folder location and highlight a file. The web application will then get the path and filename of the file. Just to be clear I dont want to open the file I just want the details.
I cant seem to find a way of doing this, can you help?
UPDATE
Apologies perhaps I havent explained my self very well.
This is so a user can reference a document saved on a file share with a particular audit (the web page is for recording audits). Therefore they will click a button and file explorer will open. They will navigate to a folder (will be different everytime) and select a file. File explorer will then close and the web application will know the path of the file and its name. I can then use this to create a link on the web page to that document.
For getting directory path use; System.IO.Path.GetDirectoryName(path)
For file name System.IO.Path.GetFileName(path) or System.IO.Path.GetFileNameWithoutExtension(path)
more info is available at http://www.dotnetperls.com/path
Use path.getFullPath() method to get the file path as a string.
If you want to get the file name only use path.getFileName() method.
I am using robotframework ,selenium2Library, selenium2 and python27 to test web program. It need to upload a file in my web program. I use Choose File to give file path value to input filed. But it is not work for firefox and it works fine in chrome. When I upload file manually in firefox, it works. It is a register page. Javascript code told that file upload field is empty when the form is trying to submit, since selenium seems did not give the file path to the value of file upload field. And other input fields all have been input values, no matter fields before this file upload filed nor those fields after it. Does anyone know how to solve this problem or is there any alternative solutions?
I've had success having selenium type the file path into the webpage directly. It works most of the time, but the site I use it on is being constantly updated and one week you can type a file path, the next week you can't, the following week you can again.
I say this as a precaution that this may not be the ultimate solution, but there are instances where it works. Your particular case may be able to use this method.
driver.find_element_by_name("FILE_UPLOAD_ELEMENT_NAME").send_keys(os.path.expanduser("~/PATH_TO_FILE"))
Feel free to find element by any other characteristic and replace the all caps parts be appropriate for your use.