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

Change webdriver.driver serenity property while run time #1289

Closed
bobby06495 opened this issue Jun 28, 2018 · 7 comments
Closed

Change webdriver.driver serenity property while run time #1289

bobby06495 opened this issue Jun 28, 2018 · 7 comments
Labels

Comments

@bobby06495
Copy link

I am trying to run test cases on both browser & mobile sequentially , so when my mobile test cases are triggered. I am trying to change webdriver.driver property during runtime, by using
environmentvariables.setproperty("webdriver","appium"). But this is ignored and tests try to run on chrome browser which is already set in serenity.prop file

My question is :Can I change the serenity.prop values during runtime , if yes? then how?
and what is the significance of environmentvariables.setproperty("webdriver","appium") ?

@bobby06495 bobby06495 changed the title Change webdriver.driver serinity property while run time Change webdriver.driver serenity property while run time Jun 28, 2018
@wakaleo
Copy link
Member

wakaleo commented Jun 30, 2018

No: environment variables are immutable, they are not meant to be changed this way. You can run a single test using multiple browsers using Screenplay.

@risinek
Copy link

risinek commented Nov 8, 2018

@wakaleo why it's not possible to change them?
I have a scenario in which it make sense to change environment variables:
I want to change the app source for some scenarios (updating older app to new one) in my suite so it would be matter of changing env variable in code in some test scenarios.. I don't want to run those scenarios in separate runs as I want single report and single run.. If I would initialize AppiumDriver manually, I would just change desired capabilities for those scenarios before initializing driver. But when I left the initialization to serenity I have no way to change these, because I cannot change that env variable appium.app as it is ummutable.

@theguywhodoesthething
Copy link

It would be useful to be able to override this. We have user stories where application behavior changes based on the browser the user is in. For example popping up a modal if the user is in IE. If browser is specified in the Scenario, we should be able to set the webdriver property in a scenario step, otherwise there's no guarantee the Scenario is running with the correct webdriver.

@tschmidt01
Copy link
Contributor

+1, my tests are starting up docker containers which I dont know the port it gets assigned at runtime.

@mansiKulkarni39
Copy link

mansiKulkarni39 commented Dec 5, 2019

In my project, I am looking for to set one property(manual like one global variable) which value I want to set in run time also should be override that property. Will it possible?
I have set property and I am able to call in my program also, but able to change it in runtime.

@wakaleo
Copy link
Member

wakaleo commented Dec 5, 2019

Just use a threadlocal variable. Environment variables are shared by all tests and therefore are immutable by design.

@mansiKulkarni39
Copy link

Ok. Thanks for instant reply.

@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
Projects
None yet
Development

No branches or pull requests

6 participants