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

Кастомный экстеншн не перетирает экстеншн по-умолчанию #100

Open
Alex05632 opened this issue Jan 21, 2021 · 1 comment

Comments

@Alex05632
Copy link

Есть кастомный экстеншн CommonFindByExtension, который, по задумке, должен перетирать FindByExtension. Соответственно, в методе test() прописаны аналогичные условия.
Но из-за того, что в классе Configuration переменная extensions инициализируется как HashMap, а не LinkedHashMap,
в классе Atlas в 57 строке получаем configuration.getExtensions(MethodExtension.class).stream() как бог на душу положит. и далее findFirst() вызовет тот экстеншн, который, по воле случая, окажется первым.

@Alex05632
Copy link
Author

Alex05632 commented Jan 21, 2021

Выдрал FindByExtension и FindByCollectionExtension через рефлексию:

WebDriverConfiguration wdc = new WebDriverConfiguration(getDriver());

        Field field = Configuration.class.getDeclaredField("extensions");

        field.setAccessible(true);

        HashMap<Class<? extends Extension>, Extension> extensions =
                (HashMap<Class<? extends Extension>, Extension>) field.get(wdc);

        extensions.remove(FindByExtension.class);

        extensions.remove(FindByCollectionExtension.class);

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

1 participant