How to set JAVA Path in Linux machine

Run below command to install JAVA

yum install java-1.8*

Once the installation is completed, run below command to check JAVA Version.

java -version

Above command should give you the following result.

openjdk version "1.8.0_232"
OpenJDK Runtime Environment (build 1.8.0_232-b09)
OpenJDK 64-Bit Server VM (build 25.232-b09, mixed mode)

Run below command to find the JAVA path.

find /usr/lib/jvm/java-1.8* | head -n 3

Above command should give you the following results.


Use last path from above result to update the bash profile.

To update the bash profile run below command.

vi .bash_profile

Update bash_profile as below.

JAVA_HOME = /usr/lib/jvm/java-1.8.0-openjdk-

Save and Exit the bash_profile.

Refresh the bash profile using the below command.

source ~/.bash_profile

After refresh, run the following command to verify the JAVA path.


Output of the above command should be:


Lambda expression in Selenium

How to use JAVA Lambda expression to select the value from drop down in selenium.

Let say you have a list and want to select a value from it.

<ul class = 'list'> 
 <li data-value="value1" class="option selection focus">Value1</li>
 <li data-value="value2" class="option selection focus">Value2</li> 
  <li data-value="value3" class="option selection focus">Value3</li> 
 <li data-value="value4" class="option selection focus">Value4</li> 

Below code can select the value from drop down as per the parameter passed in the method  

Public void selectValueFromDropDown(String SearchValue)
WebElement element = Driver.driver.findElements(By.xpath("//ul[@class='list']//li")).stream().
 filter(e-> e.getText().equalsIgnoreCase(SearchValue)).findFirst().get();;