Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

How to find an element using the REPL if it has no id?

$
0
0

I'm trying to do some UI Tests and I have an element on a view defined using XAML (no code behind is allowed on this project). When I launch the REPL and ask for the tree of elements I get this:

[[object CalabashRootView] > PhoneWindow$DecorView]
[ActionBarOverlayLayout] id: "decor_content_parent"
[FrameLayout > ... > RendererFactory_DefaultRenderer] id: "content"
[RendererFactory_DefaultRenderer]
[EntryRenderer > EntryEditText]
[EntryRenderer > EntryEditText]
[RendererFactory_DefaultRenderer > ButtonRenderer]
[Button] text: "LOGIN"
[RendererFactory_DefaultRenderer > ButtonRenderer]
[Button] text: "Register for trial"
[View] id: "statusBarBackground"
[View] id: "navigationBarBackground"

I need to access those two EntryEditText and enter some text but I can't seem to find how to specify those two controls.
Is there a way to iterate over the elements with an ID such as "decor_content_parent" or "content" and find those two?

I tried this:

app.EnterText(c=>c.Id("content").Child().Index (1), new string('9', 15));

and also this:

app.EnterText(c=>c.Id("content").Sibling().Index (1), new string('9', 15));

and this:

app.EnterText(c=>c.Id("content").Descendant().Index (1), new string('9', 15));

but I still can't access those two fields.

This is the XAML:

< Entry Placeholder="e-mail"
Text="{Binding TxtEmail}"
HorizontalOptions="FillAndExpand"
Keyboard="Email">
< /Entry>

< Entry Placeholder="password"
Text="{Binding TxtPassword}"
HorizontalOptions="FillAndExpand"
IsPassword="true">
< /Entry>

Thanks :)


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>