How to switch tab sheets?

Hello all,

I’m currently using Selenium as a web scraper. For this, I am accessing a web page with authentication. After logging in and selecting the required fields, it opens a new tab sheet where I would need to continue. However, I am unable to switch between tab sheets using the Selenium nodes. Is there any way to continue on the new tab sheet, by node or by javascript?

Many thanks,

Rutger Lorist

Rutger,

You can do this by placing a Java Snippet node, and then call webDriver.getWindowHandles() on the WebDriver. This will list you the tabs of the browser.

There, determine the proper tab and then call webDriver.switchTo().window(tabId).

Then continue execution.

Does this help?

1 Like

I have done some browser automation in the past using the selenium library for Python, so not exactly the same thing. Maybe this fits nonetheless:

If you don’t need the current tab again, you could directly close it via “Ctrl + W”. This link should have all relevant methods:
python - Open and close new tab with Selenium WebDriver - Stack Overflow

Addendum: I just remembered that I once built an example workflow which should give the idea which I describe above. You can find it on my NodePit Space here:

1 Like

Hello All,

Thank you for your replies. I have been able to also force a URL change which resolved the issue as well. In the case where this is no longer possible, I will try the java snippet method.

Regrads,
Rutger

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.