-
-
Notifications
You must be signed in to change notification settings - Fork 324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is there a way to change or get download directory of browser? #992
Comments
Please add a valid generated by check-issue |
The WaitDownload method allows you to specify the dir: Line 504 in d2ad7cb
|
if I specify in waitdownload then my file gets downloaded with alphanumeric characters and not with the original filename. And if I dont use waitdownload then it gets downloaded in downloads folder with the correct filename |
Then you need to config the preference of the browser to change the download folder: Line 248 in 009545e
It's a json value like this: Line 69 in 009545e
The doc of all preference: https://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/pref_names.cc?view=markup#l1443 |
tried this, it did not work. Still it gets downloaded in downloads folder |
Another way to find out the correct key is to check a real pref when you config the chrome with the browser's settings page, so you don't need to guess it |
savefile.default_directory this mentioned in doc I added this preference also downloadPrefernce := "{"download.default_directory":"/Users/xyz/"}" |
Works fine to me: package main
import (
"github.com/go-rod/rod"
"github.com/go-rod/rod/lib/launcher"
"github.com/go-rod/rod/lib/utils"
)
func main() {
pref := `{
"download": {
"default_directory": "/Users/yad/Downloads/ttt"
}
}`
l := launcher.New().Preferences(pref).Headless(false)
u := l.MustLaunch()
rod.New().ControlURL(u).MustConnect().MustPage()
utils.Pause()
} |
Scenario which I am trying to test is a downloaded document has the same filename as the one I uploaded in earlier part or the test. And when running the test case in different OS the download directory changes. Is there a way to either set the directory to something or get the directory so that I can assert on the downloaded file.
working on v0.114.5
The text was updated successfully, but these errors were encountered: