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

When browser is set at runtime, on invoking a super.element method, the previous browser set get invoked. #254

Open
SnehaJagdale opened this issue Jan 19, 2021 · 2 comments

Comments

@SnehaJagdale
Copy link

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?

@wakaleo
Copy link
Member

wakaleo commented Jan 19, 2021

You can't really override the Serenity browser management like that. What problem are you trying to solve?

@SnehaJagdale
Copy link
Author

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.

  1. Set OperaDriver at runntime. -> Success
  2. Launch Application at runtime. -> Success
  3. Do some validation, visibility check on the current browser set -> Failure, Chrome is launched.

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

2 participants