browserstack / webdriverio-browserstack

Selenium examples for WebDriverIO and BrowserStack Automate
https://www.browserstack.com
68 stars 93 forks source link

How to access session id? #8

Closed mohsen1 closed 6 years ago

mohsen1 commented 7 years ago

Is there anyway to access the session ID via the JS API?

huoxito commented 7 years ago

been looking for this too @mohsen1 in case it helps anyone, you can grab the current session id with browser.url().sessionId

matisnape commented 6 years ago

@huoxito you can get it with just browser.sessionId :)

imhighyat commented 4 years ago

It is telling me browser is not defined. I used both browser.sessionId and browser.url().sessionId

mireshsonkamble commented 4 years ago

@imhighyat use below mentioned code:

driver.session.then(function(sessionData) { console.log(sessionData.id); });