Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 138192

CYPRESS - Finding and yielding a table row that contains some text

$
0
0

Im trying to get the entire row that contains some text in the child elements. I want to later manipulate it but when I try:

cy.get('.tr').contains('Example Text')

... it always yields/returns the span element. I'd like to point to the div of a "tr" class which contains the text. (I've tried using parent() but then it's 2 elements down so using parent().parent() is not the solution I'm guessing).

e.g. code

<div class="tr">
    <div class="something">
        <span>Example Text</span>
    <div class="something-else">
<div class="tr">
<div class="tr">
<div class="tr">
<div class="tr">
<div class="tr">

Viewing all articles
Browse latest Browse all 138192

Trending Articles



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