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.

Better deal with strings in `switchWindow`

See original GitHub issue

Is your feature request related to a problem? Please describe. Currently the switchWindow command iterates over all window handles and calls matches on url and title to see if the input matches it. This can be problematic if users use strings that contain a regexp character:

// works perfectly if you match like this
browser.switchWindow('google.com')

// doesn't work if you have a `?` character
browser.switchWindow('google.com?foobar=barfoo') // does not match the url e.g. https://google.com?foobar=barfoo

Describe the solution you’d like Let’s check if the command input is a string and use includes if so otherwise use match if it is a RegExp.

Describe alternatives you’ve considered n/a

Additional context This comes from a conversation I had with someone in Gitter stumbling over this.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
christon88commented, Nov 18, 2020

@christian-bromann since this has not been updated for a while, do you mind if i take a shot at it?

1reaction
christian-bromanncommented, Oct 20, 2020

@kacperturon sure thing!

Read more comments on GitHub >

github_iconTop Results From Across the Web

switchWindow - WebdriverIO
matcher, String , RegExp, String or regular expression that matches the title and url of the page or window name ...
Read more >
switchWindow | API Reference - Nightwatch.js
switchWindow (). Change focus to another window. ... handleOrName, string, The server assigned window handle or the name attribute. callback
Read more >
How to handle multiple windows in Selenium - Tools QA
This method will return the value of the String type. getWindowHandles( ): To handle all opened windows which are the child windows by...
Read more >
How to handle multiple windows in Selenium? - BrowserStack
Think of it as a pointer to a window, which returns the string value. It is assumed that each browser will have a...
Read more >
C# switching windows in .net - Stack Overflow
SwitchToThisWindow is expecting a handle to the window that you ... we have switch window. private void switchWindow() { Process[] procs ...
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