140218-M
140218-M

Reputation: 19

Select value which exists within the tag

Below is my code and I am trying to select a value(velocity_and_express) which is given within the data-bip-collection attribute. How can I select the value from the lists given in data-bip-collection?

<span
  class="best_in_place highlight_on_success funding_type"
  data-bip-attr="funding_type"
  data-bip-collect="[[&quot;velocity_and_express&quot;,&quot;velocity_and_express&quot;],[&quot;velocity&quot;,&quot;velocity&quot;],[&quot;express&quot;,&quot;express&quot;],[&quot;not_yet_set&quot;,&quot;not_yet_set&quot;]]"
  data-bip-confirm="Are you sure you want to change funding type?"
  data-bip-object="company"
  data-bip-original-content="not_yet_set"
  data-bip-type="select"
  data-bip-url="/admin/companies/13"
  data-bip-value="not_yet_set"
  id="best_in_place_company_13_funding_type"
  data-ol-has-click-handler=""
>velocity</span>

I tried selecting the option using cy.get(), but it did not work.

cy.get('[data-bip-attr="funding_type"]')
  .click()
  .get('[data-bip-value="velocity_and_express"]')
  .click()

cy.on('window:confirm', () => true)

Upvotes: 0

Views: 58

Answers (1)

Daniel
Daniel

Reputation: 35684

You can use the jquery contains selector (docs) contains selector

Example:

cy.get(`[data-bip-collect*="velocity_and_express"]`)

Upvotes: 1

Related Questions