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.

Client is not accessing second window. Is it possible?

See original GitHub issue

I have an app that opens first window, does a little thing, closes the first window, and opens the second one.

When in the first window, all client APIs work.

But when in the second one, app.client.getHTML('body') throws

  Stack:
    RuntimeError: no such window: target window already closed
    from unknown error: web view not found
        at execute(<Function>) - selectorExecute.js:97:75
        at execute("return !!document.evaluate;") - ensureClientSideSelectorSupport.js:23:17

Is it possible at all to web-drive the second window?

Note that in both cases, app.client.getWindowCount() produces 1, as only one window is open, and app.client.windowHandles() changes as well.

Can a handle be used to redirect client to a new window? Or, something like this.

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:3
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

5reactions
MarshallOfSoundcommented, Jul 17, 2016

The unique ID’s are in the values property of app.client.windowHandles() and you can call app.client.window(windowHandleValue) to focus a different window.

Don’t forget we have full access to WebDriver IO methods.

http://webdriver.io/api/protocol/window.html

So you could do this yourself with.

app.client.windowHandles()
  .then((handles) => {
    const windowA = handles.values[0];
    const windowB = handles.values[1];

    // app.client.window(windowA);  <-- Will focus windowA
    // app.client.window(windowB);  <-- Will focus windowB
  });

Most of what spectron does is expose the WebDriver methods and the Electron methods in the same object to make testing ridiculously easy. Lots of the power / methods you are asking for is already part of the WebDriver methods.

0reactions
linonetwocommented, Apr 18, 2021

app.client.window is not exists…

I can get

[
  'CDwindow-3A94A50FD4E46F979A459297ECFF60D4',
  'CDwindow-4E0C8E41B579F69C850DEC94861CC0B3'
]

from const handles = await this.app?.client?.getWindowHandles();

but how to get actual window handle, and do window.$(selector)?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't access shared folders from File Explorer - Windows Client
Open Registry Editor. · Go to Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\LanmanWorkstation . Note · Press and hold (right- ...
Read more >
Screen sharing is not working - Zoom Support
If screen sharing is disabled or not working during a meeting, there are several things you can check to fix this issue.
Read more >
Install the User Client on Windows - PaperCut
Install the User Client on Windows. You can deploy the PaperCut NG/MF User Client to workstations using a variety of deployment methods.
Read more >
Using Group Policy Settings to Configure Horizon Client
The client can fall back to another authentication method if Unauthenticated Access is not available. When this setting is disabled, ...
Read more >
Windows troubleshooting - AWS Client VPN
Troubleshoot Windows connection issues to a Client VPN connection. ... Another OpenVPN process is already running on your computer, which prevents the ...
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