Forum Xamarin Xamarin Test Cloud (Read Only)

Finding a Label on a WebView using XPath

JamesLaveryJamesLavery GBBeta, University ✭✭✭✭✭

We've got a Xamarin.Forms app with a WebView on it, and I need to tap a specific label in the WebView to navigate.

I can find all the Labels on the WebView with:

c => c.XPath("//label")

and can tap a specific one using:

app.Tap(c => c.XPath("//label").Index(0));

However this is a very brittle way of identifying the correct label.

I should be able to query to get a specific label with something like:

app.Tap(c => c.XPath("//label[@LabelText='Profile']"));

However, this isn't finding the Label.

I'm probably using incorrect XPath syntax. Has anyone got this working?

Sign In or Register to comment.