JavaScript Search for a span inside a span in testcafe

<mat-option class="select-bank-option mat-option ng-star-inserted mat-selected mat-active" role="option" data-cy="selectDKCAD" tabindex="0" id="mat-option-261" aria-disabled="false" aria-selected="true"><!---->
   <span class="mat-option-text"><!----><img class="margin-right-10 ng-star-inserted" height="14px" src="/public/images/flags/dk.svg">
   <span>CAD - DnB - Bank DK CAD - 96321234567896</span><!----></span>
   <div class="mat-option-ripple mat-ripple" mat-ripple=""></div>
</mat-option>

I am trying to select the span depending on the name of it.

I am trying to click on a dropdown menu generated by angular, that has the text "CAD - DnB - Bank DK CAD - 96321234567896"

I have tried:

    .click(Selector('mat-option-text').with(bank))

and

.click(Selector('span').with(bank))

where 'bank' is the parameter of the method, and in both case, it can not find the option in the dropdown menu.

Answer:1

It seems that you are trying to query based on class="mat-option-text" using Selector from testcafe. I think you are missing a . in your Selector.

Try Selector('.mat-option-text')

Answer:2

I'm stuck on a template/component problem and I couldn't find any answer. I'm trying to move a plain Javascript project to Angular2. In my project, I actually create some elements by inherit from ...

I'm stuck on a template/component problem and I couldn't find any answer. I'm trying to move a plain Javascript project to Angular2. In my project, I actually create some elements by inherit from ...

  1. styled components nested elements
  2. styled-components nested elements

I'm using OpenLayers3 to integrate a map into a website. I added some features representing objects according to their position. I added an overlay containing data on that object when it is clicked on,...

I'm using OpenLayers3 to integrate a map into a website. I added some features representing objects according to their position. I added an overlay containing data on that object when it is clicked on,...

i am learning react and writing my own components but i ran into an issue with project organisation. here is my tree Project_Folder - Components - Form - index.js - form.less ...

i am learning react and writing my own components but i ran into an issue with project organisation. here is my tree Project_Folder - Components - Form - index.js - form.less ...

Objective: Load a variable with a string value with random characters, split each character into an array, sort those alphabetically and also made them in upper case format. At end, it's required ...

Objective: Load a variable with a string value with random characters, split each character into an array, sort those alphabetically and also made them in upper case format. At end, it's required ...