2

I am trying to switch to the browser popup window using python and selenium, the javascript code of the website I am trying to automate is like this:

<script>
// JavaScript popup window function
    function basicPopup(url) {
popupWindow = window.open(url,'popUpWindow','height=300,width=700,left=50,top=50,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no, status=yes')
    }

</script>
<a href="https://example.com" onclick="basicPopup(this.href);return false">Open a popup window</a>

It opens https://example.com on the new browser popup window.

Now, I am trying to interact with that popup browser using Selenium and python, but I do not know how. I can only switch through tabs like this:

driver.switch_to.window(driver.window_handles[1])

But it did not work as it can only switch to other "popup tabs" and not "popup browser"

S.B
  • 13,077
  • 10
  • 22
  • 49
Ppap
  • 67
  • 7
  • Does this answer your question? [Python webdriver to handle pop up browser windows which is not an alert](https://stackoverflow.com/questions/17676036/python-webdriver-to-handle-pop-up-browser-windows-which-is-not-an-alert) – lapestand Jan 10 '22 at 08:23

0 Answers0