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

SAFARI: NoSuchWindowError: A request to use a window could not be satisfied because the window could not be found. #3796

Closed
alycda opened this issue Apr 7, 2017 · 28 comments
Labels

Comments

@alycda
Copy link

alycda commented Apr 7, 2017

Meta -

OS: OSX 10.11.6
Selenium Version: 3.3.0, VSCode, npm/javascript
Browser: Safari

Browser Version: 10.1 (11603.1.30.0.34)

Expected Behavior -

Should be able to manipulate the window via driver.manage().window().setSize(1024,768)

Actual Behavior -

NoSuchWindowError: A request to use a window could not be satisfied because the window could not be found.

Steps to reproduce -

$ mocha --require bootstrap

bootstrap.js:

global.startWebdriver = function(browser) {
  return new Builder().forBrowser(browser).build()
    .then(function(driver) {
      global.driver = driver;
    })
}

test.js:

describe('suite', () => {
  it('test', async ()=> {
    await startWebdriver('chrome');
    await driver.get('http://google.com');
    await driver.manage().window().setSize(1024,768)
    ...
  });
});

I am using babel & es7, and this works just fine for chromedriver, so if you think I am missing something regarding that configuration, it's probably just been omitted for brevity in my example

@ikuwow
Copy link

ikuwow commented Apr 25, 2017

i have same issue.

@manoj9788
Copy link
Member

manoj9788 commented Apr 25, 2017

The below code works fine for me,
Node 7.8.0
Node-Selenium: 3.4.0

describe('Google Search', function() {
  let driver;

  beforeEach(async function() {
    driver = await new Builder().forBrowser('safari').build();
  });

  afterEach(async function() {
    await driver.quit();
  });

  it('example', async function() {
    await driver.get('http://google.com/ncr');
    await driver.manage().window().setSize(1024,500);
    await driver.findElement(By.name('q')).sendKeys('webdriver');
    await driver.findElement(By.name('btnG')).click();
    await driver.wait(until.titleIs('webdriver - Google Search'), 1000);
  });

});

@mike123vn
Copy link

it does not work

@mike123vn
Copy link

@manoj9788 :Can i ask your safari version?

@manoj9788
Copy link
Member

@mike123vn 10.0.2

@mike123vn
Copy link

So it seems to be that this bug appears in version >=10.1

@ikuwow
Copy link

ikuwow commented Apr 30, 2017

@manoj9788 's solution does not work for me, and my safari version is 10.1, too.

@manoj9788
Copy link
Member

I am not sure as such where could be the problem. As we don't support Safari actively now, pls raise an issue with Apple's Radar.

@burg
Copy link
Contributor

burg commented May 15, 2017

We fixed a window resizing issue in Safari Technology Preview 28: https://webkit.org/blog/7516/release-notes-for-safari-technology-preview-28/

Can you please verify on that version, or later?

@MentalDisruptor
Copy link

Verified using Safari Technology Preview Release 29.

Window came up and responded to some basic actions such as page loading, element localisation and highlighting.

Result: ✅ Test successful.
Awesome, I'll have a look at some of my more complex tests later on. Thank you for the update. 😃

@guts79
Copy link

guts79 commented Jun 14, 2017

How do start safari technology Preview in the capabilities of your conf.ts ?

@p0deje
Copy link
Member

p0deje commented Jun 15, 2017

I'm going to close this as being fixed in recent SafariDriver.

@Elangopalakrishnan
Copy link

@MentalDisruptor Hi, I have installed safari preview in my mac book,
And trying to launch the safari preview browser, How to launch that?
What are the capabilities we need to give,
I tried in c#,
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.SetCapability("browserName", "safari technology preview");

It doesn't work, it shows exception-
"The best matching driver provider org.openqa.selenium.safari.SafariDriver can't create a new driver instance for Capabilities [{browserName=safari technology preview}]

Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'

System info: host: 'mkusers-iMac.local', ip: '10.18.15.42', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12.4', java.version: '1.8.0_131'

Driver info: driver.version: unknown"

am i missing any capabilities here??

Thanks!
Elango

@MentalDisruptor
Copy link

@Elangopalakrishnan Hi there. I tried in Java, not C#. I can't tell you how to do that in C#. But I guess that you also need to set the correct SafariOptions and DesiredCapabilities in your C# code accordingly.

What I've done in Java:

DesiredCapabilities desiredCaps = DesiredCapabilities.safari();
SafariOptions sOptions = new SafariOptions();
sOptions.setUseCleanSession(true); // init a clean Safari session at all times
sOptions.setUseTechnologyPreview(true); // enable Technology Preview

desiredCaps.setCapability(SafariOptions.CAPABILITY, sOptions);
WebDriver driver = new RemoteWebDriver(
                 new URL("http://url.to.seleniumgrid.hub:4444/wd/hub"),
                 desiredCaps
);
driver.open("http://www.example.org");

Hope that helps. :)

@Elangopalakrishnan
Copy link

Elangopalakrishnan commented Jun 20, 2017

@MentalDisruptor Need to add any extension in safari technology preview browser like we added web driver 2.48 in safari browser ?

Need to specify any path in capabilities ??
sOptions.setUseCleanSession(true); // init a clean Safari session at all times
sOptions.setUseTechnologyPreview(true); // enable Technology Preview
These two enough ??
Because when i run this it opens normal safari browser,
My code,
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities = DesiredCapabilities.Safari();
SafariOptions options = new SafariOptions();
capabilities.SetCapability("UseCleanSession", "true");
capabilities.SetCapability("UseTechnologyPreview", "true")

RemoteWebDriver rwd = new RemoteWebDriver(new Uri("http://10.18.15.52:5555/wd/hub"), capabilities, TimeSpan.FromSeconds(180));
capabilities.SetCapability("UseTechnologyPreview", "true") this line is not working :(
How it will launch new safari preview, we didn't specify any thing about it here, please help me !! :(

@timsheng
Copy link

timsheng commented Jul 7, 2017

@p0deje are you sure this issue has been fixed in recent safaridriver ?

@p0deje
Copy link
Member

p0deje commented Jul 7, 2017

I haven't checked, but people above tells it's fixed.

@egrigolon
Copy link

@p0deje not fixed in Safari Version 10.1.1 (12603.2.4). I haven't tried STP though.

@p0deje
Copy link
Member

p0deje commented Jul 12, 2017

Yeah, the comments above say that it's fixed in TP.

@arjunjh10
Copy link

I am still getting this issue.

@arjunjh10
Copy link

Selenium Webdriver Version: 3.4.0
OS: OS X
Browser: Safari
Version: 10.1

Running on Browserstack. and getting the following error:

NoSuchWindowError: A request to use a window could not be satisfied because the window could not be found. (WARNING: The server did not provide any stacktrace information)```

@burg
Copy link
Contributor

burg commented Aug 21, 2017

@arjunjh10 Please read the entire thread. This is not fixed in 10.1 or 10.1.1, but it might be fixed in the latest Safari Technology Preview (37). Can you try using Safari Technology Preview?

@arjunjh10
Copy link

@burg Thanks for the reply. Yes I do realise i didnt read it thoroughly. I'd try out Tech preview for my case. Thanks again

@jbarriojim
Copy link

I'm using os.arch: 'x86_64', os.version: '10.12.6', java.version: '1.8.0_144', selenium: 3.4.0, safari: 10.1.2 and with Safari Technology Preview (Release 38, August 2017) works fine. This is my Java code:

 SafariOptions safariOpts = new SafariOptions();
 safariOpts.setUseCleanSession(true);
 safariOpts.setUseTechnologyPreview(true);

 DesiredCapabilities cap = DesiredCapabilities.safari();
 cap.setCapability(SafariOptions.CAPABILITY, safariOpts);   

And after that, the driver.manage().window().maximize() instruction, started working.

@tyaga001
Copy link

tyaga001 commented Nov 17, 2017

Mac OS - OS X EI Captain
Version - 10.11.6
Safari - 10.1.2
Protractor - 5.2.0
Node - v8.9.1
running via standalone selenium server - selenium-server-standalone-3.7.1.jar
Hi, I am still getting below error
NoSuchWindowError: A request to use a window could not be satisfied because the window could not be found.

My configurations are -

capabilities: {
'browserName': 'safari',
'safari.options': {
technologyPreview: true
},
},

@RAdevelop
Copy link

RAdevelop commented Feb 1, 2019

Hi!
I have same problem with: driver.manage().window().setSize(1024,768)

But I use NodeJS
macOS Sierra 10.12.6
Safari 12.0.3 (12606.4.5.3.1)
"selenium-webdriver": "^4.0.0-alpha.1"
node -v v11.2.0

So in selenium-webdriver 4.0.0-alpha.1 for setting window size use driver.manage().window().setRect()

My solution is calling setRect with all argumet:

For example:
driver.manage().window().setRect({"width": width, "height": height, "x": 2, "y": 2});

if U set x = 0 or 1 OR y = 0 or 1, it has error:

InvalidArgumentError: Parameter 'y' has a boolean value, which is not allowed.

OR

InvalidArgumentError: Parameter 'x' has a boolean value, which is not allowed.

That's why I set "x" = 2 and "y" = 2

:)

@burg
Copy link
Contributor

burg commented Feb 2, 2019 via email

@lock lock bot locked and limited conversation to collaborators Aug 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests