I want to get the URL I am re-directed to when I click one button on the website, and still stay on the same page instead of being redirected. The button is not a simple hyperlink and will trigger a complex Javascript function.
click() does not work for me
I refer to Selenium get URL of "a" Tag without href attribute and Selenium: Getting ultimate href/link without clicking on it when it's a javascript call, which shows that the button has to be clicked to get the URL. Of course, I can click() the button and use 'driver.current_url', but in this way I am redirected to a new URL. I do not want the redirection since I have more things to do on the current page and want to stay on the same page. I can not use CTRL + click to open the new page in a new tab, either.
My idea
I read about how to find the source Javascript code (How to find what code is run by a button or element in Chrome using Developer Tools), but I found the codes too complex for me. Should I find the codes that produce the URL?
I wonder can I just "fork" the current page? Or something like simulating/executing the Javascript code in a separate sandbox? I am using python.