Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Access to Sibling element in Playwright

$
0
0

I have two sibling spans in my DIV. I am doing E2E testing in Blazor and I want to access the second Span content (@Status).

<div><span> Status:</span><span> @Status</span></div>

I found a solution for it, if it was JavaScript according to this link.

const text = await page.locator(':text(" Status:") + span').textContent();

However, I am not sure how to do the same for C# syntax. I have access to the first span but not next one.

var firstSpan = Page.Locator("text= Status :");

Viewing all articles
Browse latest Browse all 4839

Trending Articles



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