When browser is set at runtime, on invoking a super.element method, the previous browser set get invoked.
Opened this issue · 2 comments
In the framework, I am passing initial -Ddriver="chrome", now in application I am launching an opera driver for some negative tests.
EnvironmentVariables variables = SystemEnvironmentVariables.createEnvironmentVariables();
this.operaDriverPath = variables.getProperty("webdriver.operadriver.driver");
File file = new File(this.operaDriverPath);
String absolutePath = file.getAbsolutePath();
System.setProperty("webdriver.opera.driver", absolutePath);
OperaDriver driver = new OperaDriver();
driver.manage().window().maximize();
super.setDriver(driver); ------> This I am able to set
->>> Opera driver launches here.
When super.getDriver().navigate().to(URL); ->> URL is set.
In another class , invoking the webelements is handled.
By byFieldName=WebUtils.returnByBasedOnPageNameAndObjectName(pageName,fieldName); ->> getting the feild.
super.element(byFieldName).waitUntilVisible(); -
Log.info("Element visible : " + fieldName);
return super.element(byFieldName).isVisible();
At this point allthough browser is set in Opera, browser from Chrome gets launched. Am I missing something here?
You can't really override the Serenity browser management like that. What problem are you trying to solve?
So on the application I am working, we support Chrome, IEEdge, however for a certain scripts we need to verify that Opera isn't supported. Now we run our scripts in bulk, so basically I am designing the script in such a way, that although I invoke chrome, for this particular script once I set the browser to Opera. I should be able to validate some error messages.
- Set OperaDriver at runntime. -> Success
- Launch Application at runtime. -> Success
- Do some validation, visibility check on the current browser set -> Failure, Chrome is launched.