Skip to content
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

Dynamically defining download directory at runtime with SerenityParameterizedRunner.class #1272

Closed
timothyjmtan opened this issue Jun 13, 2018 · 2 comments

Comments

@timothyjmtan
Copy link
Contributor

timothyjmtan commented Jun 13, 2018

I am currently using the SerenityParameterizedRunner for data-driven tests. In each test, I am looking for a way to:

  1. create a folder (that is unique to each set of data)
  2. download files into this folder.
  3. repeat Step 1 & 2 for each set of data

Setting the download directory is relatively straightfoward:
chromePrefs.put("download.default_directory", "path\to\file" + UUID.randomUUID().toString());

However as the webdriver initialization only happens once, all files for all tests are still downloaded to the same folder.

Trying to workaround this issue, I then tried using the @Managed annotation:
@Managed(uniqueSession = true, clearCookies = ClearCookiesPolicy.BeforeEachTest)
public WebDriver hisBrowser;

However this doesn't seem to work. I'm guessing that somehow it is not initializing a new browser instance for each dataset...

Can I get some advice on dynamically specifying download folders at runtime, for SerenityParameterizedRunner please?

@timothyjmtan timothyjmtan changed the title Unique browser session with SerenityParameterizedRunner.class Dynamically defining download directory at runtime with SerenityParameterizedRunner.class Jun 13, 2018
@jdoriyastpl
Copy link

hi @timothyjmtan ,

download.default_directory is only taking absolute path if I am setting 'chrome_preferences.download.default_directory'. But It unable to download the file if value set relative to project root path.

Do you face same issue or any help will be appreciated.

Thanks
Jitin

@Saieph
Copy link

Saieph commented Aug 23, 2018

Definitely having the same problem in my harness as well.

@wakaleo wakaleo closed this as completed Feb 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants