Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't change attributes with executeScriptAsync() #434

Open
arepsz opened this issue Feb 27, 2023 · 0 comments
Open

Can't change attributes with executeScriptAsync() #434

arepsz opened this issue Feb 27, 2023 · 0 comments

Comments

@arepsz
Copy link

arepsz commented Feb 27, 2023

So I have a pretty strange issue right now. I want to test my project with shinytest, but I have a datatable in my app that has random values (data-tabsetid). Because of these values, the tests always fail after the first run.
Writing the JS script in the source code is not an option, so that's why I tried to put the script in the test.
I use the function correctly, tried it with other JS functions and they worked fine. For example:

app$executeScriptAsync('const callback = arguments[0];

const tabsetID = document.getElementById("GLM_RESULTS_TAB");
tabsetID.textContent = "Changed";

callback();')

This does something, obviously it won't change the text in this case because it's a table, but it does something (also it changes the text on the child elements if I apply it on them). On the other hand, if I change the textContent to setAttribute() function, and try to change the "data-tabsetid" attribute to "4321" it doesn't do anything.
Am I doing something wrong or is this an issue with the package (or any other package actually)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant