STBN03
(NY)
1
I’m using Selenium with Robot framework. How to open more than one tab in Edge browser?
I tried the following
- Execute JavaScript Window.open() – Error JavascriptException: Message: javascript error: Window.open is not a function
- Press keys Ctrl+t, Control+t - types Ctrl+t in text field of the browser.
- Edge settings allows Java Script and Pop ups are not blocked.
Thanks in advance for any solution provided.
HI @STBN03,
I don’t think Selenium Library has a native way to do this, normally new tabs/windows are opened by clicking links.
There is the Execute Javascript keyword so combined with the javascript window.open() Method you could probably acheive what you want.
Then use Switch Window to select the new window.
Hope that helps,
Dave.
1 Like
STBN03
(NY)
3
Thanks for the response Dave.
As I mentioned I tried 1. Execute JavaScript Window.open()
and end up with error
“JavascriptException: Message: javascript error: Window.open is not a function”
Am I missing anything here any specific libraries loading? Currently loading the following.
Library SeleniumLibrary
Hi,
I use this with Seleniumlibrary, if you have already a browser open, and want to go to a new tab and url
Execute Javascript window.open('about:blank', '_blank');
${windowsID} Get Window Handles
Switch Window ${windowsID}[1]
Go To ${url}
I think your problem comes from the fact that Window.open has an upper case to Window object in your case. The method is open on window object.
Regards
Charlie
2 Likes
STBN03
(NY)
5
Thank you so much Charlie it worked.
I was using wrong number of parameters for window.open.
2 Likes