I'm having trouble with clicking at an element, which I find using text which is a variable. This is the code of the page:
<div class="recommendedProfileList fl">
<h3>
<ul class="ctrlResearchProfiles">
<li>
<li>
<li>
<li>
<li>
<li>
<span class="profileBtn ctrlSelectDefProfile ctrlClickSubmit" data-value="143" data-form="formChooseProfile" data-profileid="143">Sales manager</span>
<span class="profileTooltip" style="display: none;">
<span class="arrow"/>
<span class="profileTooltipContent">
</span>
and the name of the variable is profile. This is how I've tried to do this, but did not work:
WebDriverWait wait = new WebDriverWait(driver, 5);
wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//*[text()=' + profile + ']")));
second:
driver.findElement(By.xpath("//*[text()=' + profile + ']"));
also:
driver.findElement(By.linkText("" +profile)).click();
Do you know how to click such element?
Aucun commentaire:
Enregistrer un commentaire