Atata selenium web driver can't find controls by id on angular app
The issue is in wrong controls usage. Atata has unique ControlDefinition
feature which specifies base XPath of control's element. It makes element search more accurate by filtering out wrong elements. For TextInput<TOwner>
it is [ControlDefinition("input[@type='text' or not(@type)]")]
.
You email element is <input type="email">
which does not match base XPath of TextInput<TOwner>
. The same should be with password control.
Just change types of controls to EmailInput<TOwner>
and PasswordInput<TOwner>
:
public class SignInPage : Page<_>{ [FindById("email")] public EmailInput<_> Email { get; set; } [FindById("password")] public PasswordInput<_> Password { get; set; } //...}
Here is the link to input controls docs: https://atata-framework.github.io/components/#inputs
As an option you can also change both control types to Input<string, TOwner>
. It will also work as Input
has less strict ControlDefinition
.
By the way, if you need to override some default ControlDefinition
for specific control globally:
[assembly: ControlDefinition("input", ComponentTypeName = "text input", TargetType = typeof(TextInput<>))]
Or put even "*"
to match any element.
[assembly: ControlDefinition("*", ComponentTypeName = "text input", TargetType = typeof(TextInput<>))]