Can 'Browser' library and 'SeleniumLibrary' be used together?

I have a workspace where I use ‘Browser’ library in the testing.

What I really need to know is that, if I install SeleniumLibrary as well it doesn’t break any current workspace parts.

Has anyone expierence with both ‘Browser’ library as well as ‘SeleniumLibrary’ in 1 workspace?
Has anyone expierence with both ‘Browser’ library as well as 'SeleniumLibrary in 1 .robot script?

all info is welcome!

I would guess, that both libraries can exit in one environment. Selenium library uses available browser and driver installed in your environment, as browser library brings its own browsers and drivers.

In theory you could, but it will probably not allow you to do what you’d like to do.

If both are imported in a single suite (.robot file), you could open a page in both of them, but you cannot have one open a page and have the other library do anything on that page. You would have 2 browser instances that will be competely independent, one for SeleniumLibrary, one for Browser.

Also, there might be keywords defined in both libraries, which will conflict if you don’t specify the source library if you want to use them.

So odds are that you won’t be able to do what you want and it might lead to keyword conflicts.

Having both in a project / repo and using them in different suites will be fine.

1 Like

The best solution for me would be:

having ‘Browser’ library installed
having ‘SeleniumLibrary’ installed as well

1 that opens the page (preferably ‘Browser’ library) but… SeleniumLibrary that can use the keywords on that.

In order to make that work… I would have to contact the SeleniumLibrary builders/creators and ask them to -sort of- make a argument switch for that?
So that it is possible to switch it to usage of the ‘Browser’ library ‘Open Browser’ and/or ‘Open page’.

right?

“if detect library = ‘Browser’ already opened a page, aim at that instead of ours” kinda code…

Can the other way around be build as well?

"If detect library= ‘SeleniumLibrary’ already opened a page, then aim the keywords at that instance instead of our ‘Browser library - open browser’

Can we experiment with this? (would it be possible to build an argument switch for that?)

Currently I can make usage of ‘DatabaseLibrary’ and ‘Browser’ in 1 script. no problemo.

But I can’t make usage of SeleniumLibrary and Browser in 1 script… that’s kinda :frowning:
(I wish that was possible) :slight_smile:

Browser library and SeleniumLibrary browsers/pages cannot be shared between those two library. They relay on different technologies underneath, Selenium and Playwright, which do not work together.

The DatabaseLibrary talks to a database. The Browser library talks to a browser instance. So they talk to 2 different entities, they do completely different things.

What you want is to have SeleniumLibrary and Browser talk to the same browser instance, the same entity. That’s simply not possible since both have to have full control over a browser instance to do their job. This is not a RF restriction, it’s simply so that the technologies that those libraries rely on cannot do what you want.

If you’d want that to be possible, you’d have to request that functionality in the Selenium and / or PlayWright project and hope for them to support your idea and implement it.

As previous maintainer of SeleniumLibrary and current maintainer of Browser library, I can say that what you are requesting is not possible.

3 Likes

thanks for informing.