ThomasBennett Posted September 17, 2022 Posted September 17, 2022 Good morning, everyone, I am using WebDriver with ChromeDriver version 105.0.5195.52 I have the script almost completed; this is going to be used as a wait / pause until the file has completed uploading. I was able to find where the value: "C:\\fakepath\\Vladimir Harkonnen.jpg" is stored. I am trying to figure out how to read this value. This is part of an <input type="file"> element. Reading / finding the value would be the trigger to allow the script to continue. I don't know very much but I feel like I am either not using WebDriver correctly or possibly it won't be able to help me with what I am trying to do. Please see the attached screenshot. Thank you for your time, experience, and patience with me, Thomas Bennett
ThomasBennett Posted September 17, 2022 Author Posted September 17, 2022 How to read properties of DOM object via selenium Java API? - Stack Overflow This is what I am trying to do; is there a way to do this through AutoIt? Do I need to use a different user defined function? Again, thank you for your time on this, Thomas Bennett
Solution Danp2 Posted September 17, 2022 Solution Posted September 17, 2022 It looks like the filenames are located in the Files property, so you would use _WD_ElementAction to access them, ie -- $sFiles = _WD_ElementAction($sSession, $sElement, 'property', 'files') ThomasBennett 1 Latest Webdriver UDF Release Webdriver Wiki FAQs
ThomasBennett Posted September 17, 2022 Author Posted September 17, 2022 (edited) 40 minutes ago, Danp2 said: It looks like the filenames are located in the Files property, so you would use _WD_ElementAction to access them, ie -- $sFiles = _WD_ElementAction($sSession, $sElement, 'property', 'files') Thank you, @Danp2! I hope that you didn't take my comment despairingly against your work; if you did I apologize as that was not my intent. Thank you for thinking ahead and having this feature already built-in. I am still using 'value' since the script is waiting for that value to change from null to the path described above. Again, thank you for your time on this, Thomas Bennett Edited September 17, 2022 by ThomasBennett Forgot the closing line and signature.
Danp2 Posted September 18, 2022 Posted September 18, 2022 @ThomasBennettYou didn't say anything disparaging, so please stop apologizing. I will let you know if you say something offensive. I hope you would do the same for me. 😉 Browser automation via Webdriver is a complex subject, and there are usually multiple ways to tackle a given task. Just remember that "value" won't necessarily reflect if there are multiple files selected for upload. Latest Webdriver UDF Release Webdriver Wiki FAQs
ThomasBennett Posted September 18, 2022 Author Posted September 18, 2022 @Danp2, makes sense; fortunately in this case the webpage in question will only accept one file per entry. Also, a process that typically takes ~40 minutes and lots of focus is now down to approximately 6 minutes. Have you attempted to calculate how much time the Webdriver has saved the world compared to the amount of time it took to develop it? Case in point; took me ~14 hours of research and coding to get this figured out.. and looking at my work queue this script will pay for itself after I've ran it ~17 more times. Thank you again! Thomas Bennett
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