-
-
Notifications
You must be signed in to change notification settings - Fork 81
Description
It should improve overall performance, as visibility checks are executed as separate WebDriver commands for each element. Should significantly speed up control list iterations.
In Atata v1 when Visibility of control is not specified explicitly, Visibility.Visible is used by default to find the control's element, which filters only visible elements. That is useful filtering in a case when you have hidden HTML elements on a page and don't want Atata to find and interact with hidden elements. But a drawback of such filtering is performance decrease, as each element visibility check is a separate WebDriver command request.
Migration to v2.0.0
Ensure that you want this feature to be enabled for your website under test. If you have a lot of hidden/invisible HTML elements (for example, check grey HTML tags in browser developer tools) and you still want Atata to filter them out, you may consider disabling this feature. Right after the upgrade to Atata v2, run all your tests and check out the test failures. If there are not many failures because of elements visibility, and they can be solved by setting Visibility.Visible to particular controls, then you are good to go with this feature. Otherwise, you can consider the ability to disable this feature globally.
Set Visible Visibility by Default Globally
Visibility.Any behavior can be easily reverted to the one with Visibility.Visible filter that was in Atata v1 by one of the following ways:
- Using
UseDefaultControlVisibilityconfiguration method:AtataContext.GlobalConfiguration. UseDefaultControlVisibility(Visibility.Visible);
- In Atata JSON config:
{ "defaultControlVisibility": "Visible" }
Set Visible Visibility to Particular Controls
Set in FindAttribute
[FindBy("some-id")] -> [FindBy("some-id", Visibility = Visibility.Visible)]
Set in ControlDefinitionAttribute
[ControlDefinition("li")] -> [ControlDefinition("li", Visibility = Visibility.Visible)]
Set in FindSettingsAttribute
[FindSettings(OuterXPath = "./")] -> [FindSettings(OuterXPath = "./", Visibility = Visibility.Visible)]
Add FindOnlyVisibleAttribute
[FindBy("some-id")]
public TextInput<_> Name { get; private set; }->
[FindBy("some-id")]
[FindOnlyVisible]
public TextInput<_> Name { get; private set; }You can also declare [FindOnlyVisible(TargetAllChildren = true)] on page object or parent control to target it to all child controls.
Add to Dynamic Control
var input = page.Find<TextInput<SomePage>>(new FindByNameAttribute("name1"));->
var input = page.Find<TextInput<SomePage>>(new FindByNameAttribute("name1").Visible());