Roland Schmitz
Roland Schmitz

Reputation: 115

Selenium get Build info, System info, Session info & Driver info

I recently had an error in my script, wrong locator, an got:

(Session info: chrome=44.0.2403.125)
(Driver info: chromedriver=2.16.333243 (0bfa1d3575fc1044244f21ddb82bf870944ef961),platform=Windows NT 6.1 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Build info: version: '2.46.0', revision: '87c69e2', time: '2015-06-04 16:16:47'
System info: host: 'xyz123', ip: '10.1.2.11', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_75'

The error is fixed now, but this information would be very useful for my reporting. Can I get this somehow, without producing errors :-)

Thanks.

Upvotes: 1

Views: 3900

Answers (2)

Rakesh Ranjan
Rakesh Ranjan

Reputation: 106

import org.openqa.selenium.internal.BuildInfo;

BuildInfo info = new BuildInfo();
String infoString = info.toString();
System.out.println(infoString);

Upvotes: 1

spcial
spcial

Reputation: 1569

You can get all properties by using

System.getProperties()

or by using

System.out.println("All Properties: "+System.getProperties().toString())

so you can see all properties and their value. If you want a certain property you can just use:

System.getProperty("os.name")

so here you would get the property value of os.name which contains "Windows 7" in your case.

Upvotes: 1

Related Questions