# Setup Failed. No browser is open message

**URL:** <https://forum.robotframework.org/t/setup-failed-no-browser-is-open-message/6726>\
**Category:** SeleniumLibrary\
**Created:** [26 January 2024 16:26 UTC](https://forum.robotframework.org/t/setup-failed-no-browser-is-open-message/6726 "2024-01-26T16:26:38Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![LearningAutomation](https://avatars.discourse-cdn.com/v4/letter/l/958977/32.png) [@LearningAutomation](https://forum.robotframework.org/u/LearningAutomation)\
**Post date:** [26 January 2024 16:26 UTC](https://forum.robotframework.org/t/setup-failed-no-browser-is-open-message/6726/1 "2024-01-26T16:26:38Z")

</div>

I am using Robot Framework 6.1.1 and Python 3.10.4 on win32 machine. Trying to automate a process using the **init**.robot file.  
In the **init**.robot Suite Setup, I am using the Selenium Library. Open Browser (no webdriver) to open a Browser to the Application HomePage. Log in to the Application, click on the Reports Menu item which opens up a new window with a page for the two main Report categories.  
In the Test Setup of the TestReportA1. robot file, I want to click on the click on the ReportType dropdown (on the same 2nd window), navigate to the ReportA1 link and have multiple TC’s for that ReportA1 in that file  
Similar for TestReportA2.robot file-a Test Setup that will click on the Report Type dropdown, navigate to the ReportA2 link and then have multiple TC’s for that ReportA2 in that file…

The issue is that in the **init**.robot file, I can Open the Browser, log in to the system and navigate to the Reports Menu item and switch to the new window (I can see this via the Capture Page Screenshots). However, in the Test Setup of the TestReportA1. robot file, it cannot find the open browser. When I execute the TestReportA1.robot file, in the log.html, I see that the Suite Setup and Suite Teardown is successful but the Test Setup for that file fails with the message “Setup Failed. No Browser is open” message. What am i missing?

Folder structure:  
Reports–|  
|---- **init**.robot  
|  
|\_\_\_ Report A-----TestReportA1.robot  
| Test ReportA2.robot  
| TestReportA3.robot  
|  
|\_\_\_ Report B------TestReporB1.robot  
| TestReportB2.robot  
| TestReportB3.robot

---

<div class="post-metadata">

**Author:** ![EdManlove](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/edmanlove/32/1002_2.png) [@EdManlove](https://forum.robotframework.org/u/EdManlove)\
**Post date:** [26 January 2024 17:01 UTC](https://forum.robotframework.org/t/setup-failed-no-browser-is-open-message/6726/2 "2024-01-26T17:01:30Z")

</div>

Welcome to the Robot Community Forum SJ !! :robot:

A few things,

You could see if using the [alias argument](https://robotframework.org/SeleniumLibrary/SeleniumLibrary.html#Open%20Browser) for `Open Browser` and then reusing it - with the intent to reuse the existing browser - gives you the functionality you are looking for.

That should work across suite directories which using [suite initialization files](https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#suite-initialization-files) gets a bit tricky as to what is and isn’t shared in test suite files within the same directory, Reports in this case and then down into child folders like Report A and Report B.

---

<div class="post-metadata">

**Author:** ![LearningAutomation](https://avatars.discourse-cdn.com/v4/letter/l/958977/32.png) [@LearningAutomation](https://forum.robotframework.org/u/LearningAutomation)\
**Post date:** [26 January 2024 18:22 UTC](https://forum.robotframework.org/t/setup-failed-no-browser-is-open-message/6726/3 "2024-01-26T18:22:10Z")

</div>

Tried opening up the Browser/Switching Browser in the TestReportA1.robot file after setting the Alias as Global variable but to no luck…

---

<div class="post-metadata">

**Author:** ![EdManlove](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/edmanlove/32/1002_2.png) [@EdManlove](https://forum.robotframework.org/u/EdManlove)\
**Post date:** [27 January 2024 02:30 UTC](https://forum.robotframework.org/t/setup-failed-no-browser-is-open-message/6726/4 "2024-01-27T02:30:26Z")

</div>

It might be the issues of variable scope. I created the following example on my machine

Parent-|  
|----` __init__.robot`  
|  
|- Child A/  
| |-robotframework\_org.robot  
|- Child B/  
|-google\_com.robot

with ` __init__.robot`

```python
***Settings***
Library SeleniumLibrary
Suite Setup Create Browser

***Keywords***
Create Browser
    Open Browser about:blank Chrome alias=${driver_alias}

```

robotframework\_org.robot

```python
***Settings***
Library SeleniumLibrary
Library DebugLibrary
Test Teardown Close All Browsers

***Variables***
${URL} https://robotframework.org/

***Test Cases***
Open the Browser To Robotframwork.org
    Create Browser ${URL}
    Debug

***Keywords***
Create Browser
    [Arguments] ${page}
    Open Browser ${page} Chrome alias=${driver_alias}

```

google\_com.robot

```python
***Settings***
Library SeleniumLibrary

***Test Cases***
Open Browser To Google.com
    Open Browser https://www.google.com/ Chrome alias=${driver_alias}

```

Knowing you might have experienced issues with the variable and scope I immediately started of with just passing in this alias variable. Essentially I didn’t want to have to explore the question of variable scope and went right ahead with this running this in the folder above Parent,

```python
robot -v driver_alias:sd6 Parent

```

This work for me. I went ahead an checked the logs and I see on the Open Browser keyword this `INFO	Using existing browser from index 1.` log message telling me it indeed re-used that “session”.

I suspect there are a few things maybe different between both our attempts. But this seems to confirm to me it should be possible. Note I have not gone done the path of should one structure the test suite like this debate/conversation. It is worth opening the door to that and talking about subjects like test autonomy.

---

<div class="post-metadata">

**Author:** ![EdManlove](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/edmanlove/32/1002_2.png) [@EdManlove](https://forum.robotframework.org/u/EdManlove)\
**Post date:** [27 January 2024 02:49 UTC](https://forum.robotframework.org/t/setup-failed-no-browser-is-open-message/6726/5 "2024-01-27T02:49:12Z")

</div>

Just modify mine to use a global variable set by using the ``Set Global variable` keyword instead of setting it globally via the runtime parameters. So,

` __init__.robot`

```python
***Settings***
Library SeleniumLibrary
Suite Setup Create Browser

***Variables***
${driver_alias} sd6

***Keywords***
Create Browser
    Open Browser about:blank Chrome alias=${driver_alias}
    Set Global Variable ${driver_alias}

```

and executed with `robot Parent`. I will note I do have an “issue” with reuse in the robotframework\_org.robot suite above. Note on Test Teardown I run Close All browsers. In this case both with run but the google\_org test won’t be reusing the browser as I close them all already.

---

<div class="post-metadata">

**Author:** ![EdManlove](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/edmanlove/32/1002_2.png) [@EdManlove](https://forum.robotframework.org/u/EdManlove)\
**Post date:** [27 January 2024 02:53 UTC](https://forum.robotframework.org/t/setup-failed-no-browser-is-open-message/6726/6 "2024-01-27T02:53:57Z")

</div>

And that might be the difference between ours. I’ll note it really isn’t super clear that one needs to essentially reuse the `Open Browser` keyword in each instance using the alias as a means to reuse a still open browser instance. And the reuse or start afresh isn’t initially obvious in either test case. One has to dig into the logs to see if it did indeed reuse the browser.
