Using Browser, how to continue testing a page in another test case (same suite test)

Hi !

I am new with Browser Library, I am trying to test a web app. I create a test case where I manage to create a browser, context and page and I manage to do what I want.

But I want to continue with another test case (testing another feature of this web app) but I get an error which say ‘‘Can not find Active Page’’.

Here is my code :
*** Test Cases ***

Step 1
New Browser chromium ${False} slowMo=500ms
New Context baseURL= ignoreHTTPSErrors=${True}
New Page
Go To
Take Screenshot
${source}= Get Page Source
log ${source}
Type Text xpath=//input[@name=“username”] Username
Type Text xpath=//input[@name=“password”] Password
click xpath=//button[contains(text(),“Login”)]
Click xpath=//button[@aria-label=“Close”]

Take Screenshot
Get Page Source
pause execution

Step 2
Click xpath=//span[contains(text(),“Settings”)]

I also tried adding in step 2 ‘‘Go To’’
Also, Switch to browser, switch to context and switch to page (having stored the ids before) like this :

step 1
${BrowserId}= New Browser chromium ${False} slowMo=500ms
Set Suite Variable ${BrowserId_AllTests} ${BrowserId}
${ContextId}= New Context baseURL=https://${LiteServer_Ip}/#/login ignoreHTTPSErrors=${True}
Set Suite Variable ${ContextId_AllTests} ${ContextId}
${PageId}= New Page
Set Suite Variable ${PageId_AllTests} ${PageId}
Go To https://${LiteServer_Ip}/#/login

step 2
Switch Browser ${BrowserId_AllTests}
Switch Context ${ContextId_AllTests} ${BrowserId_AllTests}
Switch Page ${PageId_AllTests} ${ContextId_AllTests} ${BrowserId_AllTests}

But without success.

Is there something I miss? Or I don’t understand?

Thanks in advance !
Best regards,

Alright My bad, I have not read enough carefully the documentation…
There is the auto_closing_level argument of the browser library that is possible to set to Test, Suite or Manual.


1 Like

I am using the argument auto_closing_level=MANUAL and I still want to use hook Suite Setup but I am getting this error:
Parent suite setup failed:
ValueError: Setting for test/task can not be set on suite level}

Is there any other solution to use the argument auto_closing_level=MANUAL and Suite Setup hook?