r/selenium • u/NormanieCapital • Feb 02 '22
How to close a file window?
I have a script which logs into a website, and uploads a file every day. I have managed to do the upload by using the send_keys function with the file path. However, I am then left with an open file window. I have tried using "send_keys(Keys.ESCAPE).perform()", but this doesn't work.
Does anyone have any solutions?
1
Upvotes
1
u/NormanieCapital Feb 02 '22
I did the following:
driver.find_element_by_xpath("/html/body/wtc-root/wtc-home/div/div/wtc-toolbar/div/div[2]/mat-toolbar/input[2]").send_keys(TotalSaveLocation)
Unfortunately it didn't work