I am new to stackoverflow so apologies if this is a bit all over the place but I can't seem to find any easy answer online for what seems like a pretty small task! :(
I am trying to Copy some data from a pop-up, that says something like "Congrats, Your Ref (REF1234) completed successfully" (just the REF1234 part) and copy it to paste into another field on the next screen... This is what I have so far, which hopefully makes sense to someone...
export function addRefToThing() {
cy.get('[class="ref-success"]').find(':selected').contains('REF').then(($clipboard) => {
const copiedRef = $clipboard[0]._vClipboard.clipboardAction.text;
// <<filler steps, moving around pages>> //
webpage.RefNo().type(copiedRef)})
This is pretty much as far as I've been able to get and pulling my hair out ... Looks like it's getting caught up at -find :selected but not actually sure it's even copying the data I want...
I'm pretty new to cypress so this is proving pretty confusing and if anyone has any good training material regarding this kind of request, that'd be awesome! Thanks in advance!
HTML:
<div class="notification-group" style="width: 300px; bottom: 0px; right: 0px;">
<span>
<div data-id="1" class="notification-wrapper" style="transition: all 300ms ease 0s;">
<div class="notification-template notification success">
<div class="notification-title">Successful</div>
<div class="notification-content">Ref (REF123456789) created successfully</div>
</div>
</div>
</span>
</div>