How to get the WebDriver version during test run

0 votes

I am currently writing on a test framework where the report should include the WebDriver version of the test run. 

While using Selenium, there is this getEval("Selenium.version") method but I find no way to read the version when using the WebDriver. 

Can anyone help me with the solution?

May 24, 2019 in Selenium by Surya
• 970 points
654 views

1 answer to this question.

0 votes

Hi friend,

It is possible by reading the VERSION.txt properties file

final Properties p = new Properties();
p.load(getSeleniumResourceAsStream("/VERSION.txt"));
String rcVersion = p.getProperty("selenium.rc.version");
String rcRevision = p.getProperty("selenium.rc.revision");
String coreVersion = p.getProperty("selenium.core.version");
String coreRevision = p.getProperty("selenium.core.revision");
BuildInfo info = new BuildInfo();
String versionString = String.format("v%s%s, with Core v%s%s. Built from revision %s",
    rcVersion, rcRevision, coreVersion, coreRevision, info.getBuildRevision());

Note that it requires a static import:

import static org.openqa.selenium.browserlaunchers.LauncherUtils.getSeleniumResourceAsStream;

Hope this helps

answered May 28, 2019 by Vaishnavi
• 1,180 points

Related Questions In Selenium

0 votes
2 answers

Can anyone help me that how to run Selenium WebDriver test cases in Chrome?

You first need to download chrome driver ...READ MORE

answered Aug 26, 2019 in Selenium by Abha
• 28,140 points
1,975 views
0 votes
1 answer
0 votes
1 answer

How to run a group of test cases using TestNG in Selenium Webdriver?

Hey Kajal, TestNG allows you to perform ordered ...READ MORE

answered Jun 12, 2019 in Selenium by Abha
• 28,140 points
2,929 views
0 votes
1 answer

How to get the select options using Selenium WebDriver in Java

Hey there! You should be able to get ...READ MORE

answered Jun 14, 2019 in Selenium by Surya
• 970 points
4,755 views
0 votes
2 answers

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,500 points
13,686 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
9,149 views
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,910 points
7,228 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
7,880 views
0 votes
1 answer

How to pass parameters to a Junit test case from the Ant build tool?

The JUnit task accepts nested system property elements. <junit fork="no"> <sysproperty ...READ MORE

answered Mar 7, 2019 in Selenium by Vaishnavi
• 1,180 points
1,739 views
0 votes
1 answer

How to auto-refresh the ChromeDriver using Selenium Webdriver?

You can use this command. Also, refresh ...READ MORE

answered May 10, 2019 in Selenium by Vaishnavi
• 1,180 points

edited May 10, 2019 by Omkar 13,716 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP