Skip to content

Commit b49ae75

Browse files
committed
[JS] Set browserName by default when browserOptions are used
1 parent aaa7e79 commit b49ae75

File tree

1 file changed

+11
-0
lines changed
  • javascript/node/selenium-webdriver

1 file changed

+11
-0
lines changed

javascript/node/selenium-webdriver/index.js

+11
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,17 @@ class Builder {
596596

597597
browser = capabilities.get(Capability.BROWSER_NAME)
598598

599+
/**
600+
* If browser is not defined in forBrowser, check if browserOptions are defined to pick the browserName
601+
*/
602+
if (!browser) {
603+
const options =
604+
this.chromeOptions_ || this.firefoxOptions_ || this.ieOptions_ || this.safariOptions_ || this.edgeOptions_
605+
if (options) {
606+
browser = options['map_'].get(Capability.BROWSER_NAME)
607+
}
608+
}
609+
599610
if (typeof browser !== 'string') {
600611
throw TypeError(
601612
`Target browser must be a string, but is <${typeof browser}>;` + ' did you forget to call forBrowser()?',

0 commit comments

Comments
 (0)