Reputation: 101
I'm trying to achieve a tab of Send sms
, Hope this image will help you, what i'm looking for. Please see here.
So, here is source code:
<li id="sendSMS" class="active">
<a href="javascript:loadSMSPage('sendSMS');">Send SMS</a>
</li>
Now, I tried this source code:
driver.findElement(By.linkText("Send SMS")).click();
Unfortunately, This is NOT working :(
Please help, Surely help would be appreciated!
Upvotes: 1
Views: 881
Reputation: 16201
I don't usually rely on linkText
that much Try using xpath
with text based search
also, try this
//li[@id='sendSMS']/a
By byXpath = By.xpath("//a[.='Send SMS']");
WebElement myDynamicElement = (new WebDriverWait(driver, 10))
.until(ExpectedConditions.presenceOfElementLocated(byXpath);
myDynamicElement.click();
EDIT:
Added explicit
wait
Upvotes: 1