I tried to search for a similar problem but I couldn't find one. here is my problem - In my React app - I have a button that after pressing on it, it should open a new URL (in the same tab) - so far so good. I know that in the new URL there is a button with an identifier. How can I open the window and after the DOM is loaded - press the button? when I tried to use querySelect to get the button I received null but I believe it's because that the DOM was not fully loaded.
here is the onClick function:
function func(){
newPath = '***SOME URL****';
newWindow = window.open(newPath , "_self");
newWindow.document
.querySelector("*** SOME IDENTIFIER ***")
.click();
}
Is it possible? if so, what is the best approach to handle this case? Thanks.