<ul id="name" class="abc">
<li class="def">
<a class="ghi">
<i style="background-color: transparent;">Welcome {{username}} </i>
</a>
</li>
</ul>
Selenium IDE:
storeText //ul[@id="name"]/li/a/i a
echo ${a}
The text "Welcome {{username}}" is displayed correctly.
However, in Selenium WebDriver, I am not able to get the text.
driver.findElement(By.xpath("//ul[@id='name']/li/a/i")).getText();
The above line of code returns an empty value.
Htmlnot animage./ul[@id='name']/li/a/iinstead of//ul[@id='name']/li/a/iand see.