question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

It should be possible to configure Open Browser keyword to not always open a new browser.

See original GitHub issue

Many times, when opening browser, there is need to open only one browser. But because depending how test are executed in Robot Framework, it is hard to find a single correct place for the Open Browser keyword. Most of the time, it is safer to run the Open Browser keyword from multiple levels in the suite structure, which will lead to many open browsers and loss in test execution time. There are also numerous other workarounds available.

Instead of the workarounds, it would be good to implement support for the Open Browser keyword to open browser only once. If the the Open Browser keyword is configured to open browser only one time, it would act in same way as the Go To keyword.

The alias argument could act as a marker, should the existing browser be used or new one opened.

Currently if test does this:

| Open Browser | https://github.com/robotframework/SeleniumLibrary | Chrome | alias |
| Open Browser | https://github.com/robotframework/SeleniumLibrary | Chrome | alias |

It will open two browsers with same alias.

But after the change, this:

| Open Browser | https://github.com/robotframework/SeleniumLibrary | Chrome | alias |
| Open Browser | https://github.com/robotframework/SeleniumLibrary | Chrome | alias |

will open one browser. With the first Open Browser keyword run, it will open the browser normally and navigate to the https://github.com/robotframework/SeleniumLibrary. In the second Open Browser keyword run, it navigate (again) to the https://github.com/robotframework/SeleniumLibrary.

Also this:

| Open Browser | https://github.com/robotframework/SeleniumLibrary | Chrome | alias |
| Open Browser | https://github.com/robotframework/SeleniumLibrary | Firefox | alias |

will open only one browser.

If different alias is used:

| Open Browser | https://github.com/robotframework/SeleniumLibrary | Chrome | alias1 |
| Open Browser | https://github.com/robotframework/SeleniumLibrary | Chrome | alias2 |

it will open two browsers.

Also if alias is not defined

| Open Browser | https://github.com/robotframework/SeleniumLibrary | Chrome |
| Open Browser | https://github.com/robotframework/SeleniumLibrary | Chrome |

it will open two browsers.

There is small change that someone is misusing the alias argument and therefore this may cause problems for users. But because the problem should be easy to fix and the probability for that is quite low, implementing this is OK.

This idea is also presented in #701

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:13 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
pekkaklarckcommented, Mar 12, 2019

I’d say there are several good solutions:

  1. Call the private method in ConnectionCache. But also submit an issue/PR exposing that method and then change SL to use the new method once it’s available. Some work but possibly benefits also others.

  2. Have a separate index to alias map in SL. Easy.

  3. Don’t return the index in the first place. I don’t see much use for them because aliases are a much better way to switch between browsers. One possibility would be returning the actual WedDriver instance instead. If that’s done, Switch Browser could be enhanced to allow using that when switching making the change mostly backwards compatible. Should consider making it an error to use Open Browser twice without an alias, though.

0reactions
aaltatcommented, Apr 23, 2019

Opened because incomplete None handling.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No "open browser" keyword in seleniumlibrary
Hi there,. I'm new to selenium, after setup new project/suite/testcase & add seleniumlibrary, I can't find open browser keyword. Scenario:
Read more >
No keyword with name 'Open Browser' found - Stack Overflow
This type of error message may have several reasons : 1- The number of spacing between keywords and the variable; ...
Read more >
open browser keyword not found - Google Groups
Hi, I am new to robot framework. I just finished installing all the necessary components following the instruction in the robotframework page.
Read more >
Browser and web automation | Robocorp documentation
When you open a browser using the Open Available Browser keyword, you get a blank state: the browser is not logged into any...
Read more >
Browser.Playwright — RPA Framework documentation
The Open Browser keyword opens a new browser, a new context and a new ... All keywords in the library that need to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found