Im using SauceLabs and I need the sessionId to get the Job Id there and use it to set pass/fail status during execution of the test. How can I get the session Id using python?
We can get the webdriver session id with Selenium webdriver using the SessionId class. A session id is a distinctive number that is given to the webdriver by the server. This number is utilized by the webdriver to establish communication with the browser.
We can interact with an existing browser session. This is performed by using the Capabilities and ChromeOptions classes. The Capabilities class obtains the browser capabilities with the help of the getCapabilities method.
We can keep a session alive for long Selenium scripts in automation. In Chrome browser, this can be achieved with the help of the ChromeOptions and Capabilities classes. Capabilities class can get the capabilities of the browser by using the method – getCapabilities.
Found it!
The value of the Selenium Remote Webdriver sessionId can be retrieved by
self.driver.session_id
That value is used on SauceLabs to identify the Jobs (Job ID)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With