galen
galen copied to clipboard
check Component Spec on self Object
Hi!
When you try to apply a component spec on the self
element a exception will be thrown:
self:
component someSpec.gspec
Exception:
Caused by: java.lang.IllegalArgumentException: objectContextLocator cannot be null
at com.galenframework.page.selenium.SeleniumPage.findObjectContext(SeleniumPage.java:82)
at com.galenframework.page.selenium.SeleniumPage.<init>(SeleniumPage.java:66)
at com.galenframework.page.selenium.SeleniumPage.createObjectContextPage(SeleniumPage.java:158)
at com.galenframework.validation.specs.SpecValidationComponent.checkInsideNormalWebElement(SpecValidationComponent.java:159)
at com.galenframework.validation.specs.SpecValidationComponent.check(SpecValidationComponent.java:56)
at com.galenframework.validation.specs.SpecValidationComponent.check(SpecValidationComponent.java:40)
at com.galenframework.validation.PageValidation.check(PageValidation.java:70)
at com.galenframework.validation.PageValidation.check(PageValidation.java:60)
at com.galenframework.validation.SectionValidation.checkObject(SectionValidation.java:187)
at com.galenframework.validation.SectionValidation.checkObjects(SectionValidation.java:97)
at com.galenframework.validation.SectionValidation.checkSection(SectionValidation.java:131)
at com.galenframework.validation.SectionValidation.checkPageSection(SectionValidation.java:76)
at com.galenframework.validation.SectionValidation.check(SectionValidation.java:53)
at com.galenframework.validation.specs.SpecValidationComponent.checkInsidePage(SpecValidationComponent.java:141)
at com.galenframework.validation.specs.SpecValidationComponent.checkInsideNormalWebElement(SpecValidationComponent.java:161)
at com.galenframework.validation.specs.SpecValidationComponent.check(SpecValidationComponent.java:56)
at com.galenframework.validation.specs.SpecValidationComponent.check(SpecValidationComponent.java:40)
at com.galenframework.validation.PageValidation.check(PageValidation.java:70)
at com.galenframework.validation.PageValidation.check(PageValidation.java:60)
at com.galenframework.validation.SectionValidation.checkObject(SectionValidation.java:187)
at com.galenframework.validation.SectionValidation.checkObjects(SectionValidation.java:97)
at com.galenframework.validation.SectionValidation.checkSection(SectionValidation.java:131)
at com.galenframework.validation.SectionValidation.checkPageSection(SectionValidation.java:76)
at com.galenframework.validation.SectionValidation.check(SectionValidation.java:53)
at com.galenframework.api.Galen.checkLayoutForPage(Galen.java:114)
at com.galenframework.api.Galen.checkLayout(Galen.java:86)
at com.galenframework.api.Galen.checkLayout(Galen.java:69)
at com.galenframework.javascript.GalenJsApi.checkLayout(GalenJsApi.java:104)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:126)
... 37 more
A possible workaround is to use @import
for this special use case. Note that @import
can also be used in combination with @if
.