I need to fetch text 'Finance' from the span tag below to compare that with another value which is saved in a file.But I am not able to fetch that.
<span class="panel-text col-md-8">Finance</span>
Here is the full code for the above
<div class="dashboard-panel dashboard-type-employee-input">
<div class="dashboard-panel-header">
<i class="fa fa-edit"></i>
<span class="dashboard-panel-title">Provided Employee Input</span>
</div>
<div class="dashboard-panel-content">
<!---->
<div class="ng-star-inserted">
<!---->
<!---->
<div class="col-md-12 ng-star-inserted">
<span class="panel-text label col-md-4">Department in which the employee works:</span>
<span class="panel-text col-md-8">Finance</span>
</div>
</div>
<div class="ng-star-inserted">
<!---->
<!---->
<div class="col-md-12 ng-star-inserted">
<span class="panel-text label col-md-4">Employee's Date of Birth:</span>
<span class="panel-text col-md-8">03-08-1990</span>
</div>
</div>
<div class="ng-star-inserted">
<!---->
<!---->
<div class="col-md-12 ng-star-inserted">
<span class="panel-text label col-md-4">County in which the employee works:</span>
<span class="panel-text col-md-8">Iowa</span>
</div>
</div>
<div class="ng-star-inserted">
<!---->
<!---->
<div class="col-md-12 ng-star-inserted">
<span class="panel-text label col-md-4">Employee's home address:</span>
<span class="panel-text col-md-8">Station Street</span>
</div>
</div>
<div class="ng-star-inserted">
<!---->
<!---->
<div class="col-md-12 ng-star-inserted">
<span class="panel-text label col-md-4">Employee ID:</span>
<span class="panel-text col-md-8">M1669</span>
</div>
</div>
<div class="ng-star-inserted">
<!---->
<!---->
<div class="col-md-12 ng-star-inserted">
<span class="panel-text label col-md-4">Authorization Code:</span>
<span class="panel-text col-md-8">45637</span>
</div>
</div>
</div>
</div>
The xpath selector for the above code is given below
element(by.xpath('//*[@id="employer-call"]/div[2]/div[2]/efx-tabs/div/efx-tab[4]/div/div/employee-input-panel/efx-dashboard-panel/div/div[2]/div[1]/div/span[2]'));
How can I get the text from the tag.I tried by adding text() to the path and also using getText() and InnerHtml
//*/span[contains(text(),"Finance")]