Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

While handelling multiple windows, if one is closed - switching to another gives a new browser session #172

Closed
SydorenkoSergiy opened this issue May 2, 2018 · 2 comments

Comments

@SydorenkoSergiy
Copy link

SydorenkoSergiy commented May 2, 2018

If selene handles multiple windows, and one of them is closed at some point (not by Selene), trying to switch to second window - will close the browser, and open a new browser session

selene==1.0.0a13

Steps to reproduce:

  1. Given a browser_win1
  2. Click on link (opens browser_win2)
  3. Switch to browser_win2
  4. Click on certain item in browser_win2 (window closes, as intended. Not by selene)
  5. Try to switch to browser_win1

Actual result:
Browser_win1 closes. Opens a new browser session

Expected result:
Switching to browser_win1 and continue working

Image proof:
Before selecting an item, there are indeed two windows opened.
screen shot 2018-05-02 at 12 05 14 pm

@maxim-zaitsev
Copy link

maxim-zaitsev commented May 16, 2020

I got the same behavior if browser is crashing. I don't know exactly the reason but it's happening when i try to open new tab via link and switch to it. Selene makes a new local browser instance at this case, despite of remote driver using.
I'd prefer that selene falls with an honest error, and not disguised as a check error

Step to reproduce:

  1. Set breakpoint on string "browser.should(have.url_containing('python.org'))"
  2. Run code in debug mode
  3. When breakpoint is reached, close browser by your self
  4. Continue code execution
  5. A new local browser instance is appearing
from selenium import webdriver
from selenium.webdriver import ChromeOptions

from selene.api import *


SELENOID_IP = '172.17.21.145'

options = ChromeOptions()
capabilities = {
    "acceptInsecureCerts": True,
    "enableVNC": True,
    "enableLog": True,
    "timeZone": "Europe/Moscow"
}
driver = webdriver.Remote(command_executor=f'http://{SELENOID_IP}:4444/wd/hub',
                          options=options,
                          desired_capabilities=capabilities
                          )

config.driver = driver
browser.open('https://python.org')
browser.should(have.url_containing('python.org'))
config.quit_driver()

yashaka added a commit that referenced this issue May 18, 2020
…of driver creation; removed dependency on browser_name in logic of recreation of shared driver; now only shared.browser.open will recreate driver if there was a crash
yashaka added a commit that referenced this issue May 19, 2020
…then it's not mandatory to call shared.browser.open first; bumped 2.0.0a26
@yashaka
Copy link
Owner

yashaka commented May 19, 2020

Should be fixed in 2.0.0a26 ;)
See the changelog for details

@yashaka yashaka closed this as completed May 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants