-
Troubleshooting input value recognition in Angular using dev tools
Hey, I’ve been working on making my workflow a bit more efficient with GA4 by creating a set of dimensions for a long list of GA4 properties. Basically, I have a script that I run in the dev tools console that does the grunt work for me. It’s basically like having an extra pair of hands to click and type for me.
The only issue is that after running the code, the page acts like the field hasn’t changed. It seems like some sort of validation step isn’t kicking in, so the save button is just hanging out there, disabled. What’s weird is if I manually click into the field, it displays a validation error but then if I copy and paste the same text, it’s suddenly fine.
Here’s a peek at the code I’m currently running:
document.querySelector('button.create-definition-button').click(); document.querySelector('definition-builder input.custom-name-control').value = dimensions[i].customName;
I tried perfecting my code to mirror as close as possible to what I’d manually do by adding varying combinations of the following:
document.querySelector('definition-builder input.custom-name-control').click(); document.querySelector('definition-builder input.custom-name-control').blur(); document.querySelector('definition-builder input.custom-name-control').dispatchEvent(new Event('change'));
No dice though. Can’t seem to crack it. Any thoughts?
Log in to reply.